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
It should pass. The type checker should use the requirement from the base class to inform the subclass property inference, similar to how normal assignment works:
(property) Sub.x: string
Property 'x' in type 'Sub' is not assignable to the same property in base type 'Base'.
Type 'string' is not assignable to type '"a" | "b"'.(2416)
(property) Sub.y: number[]
Property 'y' in type 'Sub' is not assignable to the same property in base type 'Base'.
Type 'number[]' is missing the following properties from type 'readonly [number, number]': 0, 1(2416)
TypeScript Version: 3.8.0-dev.20191115
Search Terms:
subclass property inference string literal tuple type
Code
Expected behavior:
It should pass. The type checker should use the requirement from the base class to inform the subclass property inference, similar to how normal assignment works:
Actual behavior:
Playground Link:
https://www.typescriptlang.org/play/#code/MYGwhgzhAEBCkFNoG8CwAoa0BOCwBMB7AOxAE9oAPALmgHIw7oAfegIyYF57GBuDLLgIly0MrSFFSFANrEArgFs2CbABpoC5aoC60bjICMGgEw7+6AL4YMoSDADK8ttASUALgmL4Y8CEjRMKn12OgssCgMAZg0AFnMMSyA
Related Issues:
None found
The text was updated successfully, but these errors were encountered: