We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
unique symbol
typeof {nameOfVariable}
symbol
Describe the bug
Version: 19.0.0
Variables declared with unique symbol type have a getType() value of typeof {nameOfVariable} rather than symbol
getType()
To Reproduce
Here's some code that reproduces the bug:
// test.ts import { Project } from "ts-morph"; const code = `const aSymbol: symbol = Symbol("a"); const aUniqueSymbol: unique symbol = Symbol("b"); console.log(aSymbol, typeof aSymbol); console.log(aUniqueSymbol, typeof aUniqueSymbol); `; const aSymbol: symbol = Symbol("a"); const aUniqueSymbol: unique symbol = Symbol("b"); console.log(aSymbol, typeof aSymbol); console.log(aUniqueSymbol, typeof aUniqueSymbol); const project = new Project(); project.createSourceFile("test_a.ts", code); const aSymbolVariable = project.getSourceFile("test_a.ts")!.getVariableDeclarationOrThrow("aSymbol"); const aSymbolType = aSymbolVariable.getType(); console.log(`ts-morph: aSymbol's type: ${aSymbolType.getText()}`); // "symbol" const aUniqueSymbolVariable = project.getSourceFile("test_a.ts")!.getVariableDeclarationOrThrow("aUniqueSymbol"); const aUniqueSymbolType = aUniqueSymbolVariable.getType(); console.log(`ts-morph: aUniqueSymbol's type: ${aUniqueSymbolType.getText()}`); // "symbol"
The output:
$ ts-node test.ts Symbol(a) symbol Symbol(b) symbol ts-morph: aSymbol's type: symbol ts-morph: aUniqueSymbol's type: typeof aUniqueSymbol
Expected behavior
I expected the type to be the same as the typeof result in TypeScript; that is, symbol.
typeof
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Version: 19.0.0
Variables declared with
unique symbol
type have agetType()
value oftypeof {nameOfVariable}
rather thansymbol
To Reproduce
Here's some code that reproduces the bug:
The output:
Expected behavior
I expected the type to be the same as the
typeof
result in TypeScript; that is,symbol
.The text was updated successfully, but these errors were encountered: