-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TS doesn't see when we add symbol properties to functions. #29821
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
What is the cleanest workaround BTW, anyone knows? I mean except adding |
const foo: Foo = Object.assign(() => { }, {
[mySymbol]: true as true // must cast, literal types will be widened here to boolean causing an error on assignment, but it will work with other things.
}); |
@dragomirtitian Woah! Indeed! Cool! Thanks! 👍 👍 👍 |
This one was already fixed by #54726 , the given playground still doesn't work though and I prepared a fix for it here: #55357 . I think that this issue can already be closed since what I noticed is orthogonal, cc @jakebailey |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 3.4.0-dev.20190207
Search Terms:
function, property, symbol
Code
Expected behavior:
Just like with regular (non-symbol) props, show no error if the symbol property actually has been added .
Actual behavior:
There is an error.
Playground Link: link
The text was updated successfully, but these errors were encountered: