-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Issue implementing interface #14954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The type of 'foo' will be widened to |
Typescript is unable to infer literal types, unless it is a constant. For example: let x = 1;
const y: 1 = x; // error, but shouldn't be const x = 1;
const y: 1 = x; // no error const x = { foo: 'bar' };
const y: { foo: 'bar' } = x; // error, but shouldn't be const x: { foo: 'bar' } = { foo: 'bar' };
const y: { foo: 'bar' } = x; // no error |
@Andy-MS yes I did something similar: @vkurchatkin in your third example, |
@testerez right, you can't make property a constant in TypeScript. Still, this shouldn't be an error. |
Duplicate #7011 - if the initializer were contextually typed this would work as expected |
TypeScript Version: 2.2.2
Code
Expected behavior:
no error
Actual behavior:
The text was updated successfully, but these errors were encountered: