Skip to content

symbol does not match interface #29713

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

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

symbol does not match interface #29713

ljharb opened this issue Feb 3, 2019 · 1 comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript
Milestone

Comments

@ljharb
Copy link
Contributor

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

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Feb 5, 2019
@ljharb
Copy link
Contributor 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.

@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants