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

`symbol` does not match interface #29713

Open
ljharb opened this Issue Feb 3, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@ljharb
Copy link

ljharb commented Feb 3, 2019

TypeScript Version: playground and 3.3

Search Terms: symbol interface

Code

const sym: symbol = Symbol();

function f(arg: { constructor?: unknown }): void {
}

f(sym);

Expected behavior:
symbol is a non-nullish primitive, as such, it should be able to potentially match any interface.

Actual behavior:
Type error.

Playground Link: https://www.typescriptlang.org/play/#src=const%20sym%3A%20symbol%20%3D%20Symbol()%3B%0D%0A%0D%0Afunction%20f(arg%3A%20%7B%20constructor%3F%3A%20unknown%20%7D)%3A%20void%20%7B%0D%0A%7D%0D%0A%0D%0Af(sym)%3B

Related Issues: #29536 (discovered in relation to #28900), #1863, #24587

@ljharb

This comment has been minimized.

Copy link
Author

ljharb commented Feb 12, 2019

Can't repro it in the playground, but this might also apply to bigints - getting a similar error locally with the latest next build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment