Created
November 19, 2017 21:06
-
-
Save nickytonline/63f4988fef2b108f8299c0c16a4e8a4b to your computer and use it in GitHub Desktop.
Related to this thread https://twitter.com/chriseppstein/status/932351020574707712
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Association<TKey, TValue> { | |
key: TKey; | |
info: TValue; | |
} | |
interface StringKeyInfo { | |
keyIndexes: Array<Association<string, number>>; | |
keyIsSet: Array<Association<string, boolean>>; | |
} | |
function initializeStringKeyInfo(key: string): StringKeyInfo { | |
const keyIndexesDefault: Association<string, number> = { key, info: 0 }; | |
const keyIsSetDefault: Association<string, boolean> = { key, info: true }; | |
return { | |
keyIndexes: [keyIndexesDefault], | |
keyIsSet: [keyIsSetDefault] | |
}; | |
} | |
class StringKeys { | |
private info = initializeStringKeyInfo(""); | |
keys: [""]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, so, imagine a refactoring where we change the declaration of the member.
Here's the error message. With more complex types, this gets way worse.