You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This is defined in a d.ts file. classTest{someObj: {someString: 'this'|'that'|'the other'};}// This is me actually using the class.classTest2implementsTest{someObj={someString: 'this'}}
Expected behavior:
No error thrown. Using literal 'this' as the value for someObj.someString correctly implements class.
Actual behavior:
Error thrown.
Class 'Test2' incorrectly implements interface 'Test'.
Types of property 'someObj' are incompatible.
Type '{ someString: string; }' is not assignable to type '{ someString: "this" | "that" | "the other"; }'.
Types of property 'someString' are incompatible.
Type 'string' is not assignable to type '"this" | "that" | "the other"'.
Type 'string' is not assignable to type '"the other"'.
The text was updated successfully, but these errors were encountered:
TypeScript Version: nightly (2.0.0-dev.201xxxxx)
Relevant StackOverflow discussion
Playground
Kudos to @nitzantomer for looking into this
Code
Expected behavior:
No error thrown. Using literal
'this'
as the value forsomeObj.someString
correctly implements class.Actual behavior:
Error thrown.
The text was updated successfully, but these errors were encountered: