Last active
March 27, 2018 17:46
-
-
Save TitasGailius/34056b8ae17502c465f4688f606507f3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export interface Module<State> { | |
state(): State | |
} | |
export interface FooState { | |
foo: String, | |
} | |
// No error | |
const correct: Module<FooState> = { | |
state() { | |
return { | |
foo: 'bar', | |
baz: 'qux' | |
} | |
} | |
} | |
// Error | |
const wrong: Module<FooState> = { | |
state(): FooState { | |
return { | |
foo: 'bar', | |
baz: 'qux' // <-- 'baz' does not exist in type 'FooState' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment