Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tsc/internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -14237,7 +14237,7 @@ func (c *Checker) getCannotFindNameDiagnosticForName(node *ast.Node) *diagnostic
return core.IfElse(c.compilerOptions.UsesWildcardTypes(),
diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun,
diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig)
case "Map", "Set", "Promise", "ast.Symbol", "WeakMap", "WeakSet", "Iterator", "AsyncIterator", "SharedArrayBuffer", "Atomics", "AsyncIterable",
case "Map", "Set", "Promise", "Symbol", "WeakMap", "WeakSet", "Iterator", "AsyncIterator", "SharedArrayBuffer", "Atomics", "AsyncIterable",
"AsyncIterableIterator", "AsyncGenerator", "AsyncGeneratorFunction", "BigInt", "Reflect", "BigInt64Array", "BigUint64Array":
return diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later
case "await":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
missingSymbolLibraryDiagnostic.ts(12,1): error TS2583: Cannot find name 'Symbol'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
missingSymbolLibraryDiagnostic.ts(13,21): error TS2583: Cannot find name 'Symbol'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
missingSymbolLibraryDiagnostic.ts(14,22): error TS2583: Cannot find name 'Symbol'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.


==== missingSymbolLibraryDiagnostic.ts (3 errors) ====
interface Array<T> {}
interface Boolean {}
interface Function {}
interface CallableFunction extends Function {}
interface NewableFunction extends Function {}
interface IArguments {}
interface Number {}
interface Object {}
interface RegExp {}
interface String {}

Symbol("value");
~~~~~~
!!! error TS2583: Cannot find name 'Symbol'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
const shorthand = { Symbol };
~~~~~~
!!! error TS2583: Cannot find name 'Symbol'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
type MissingSymbol = Symbol;
~~~~~~
!!! error TS2583: Cannot find name 'Symbol'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//// [tests/cases/compiler/missingSymbolLibraryDiagnostic.ts] ////

//// [missingSymbolLibraryDiagnostic.ts]
interface Array<T> {}
interface Boolean {}
interface Function {}
interface CallableFunction extends Function {}
interface NewableFunction extends Function {}
interface IArguments {}
interface Number {}
interface Object {}
interface RegExp {}
interface String {}

Symbol("value");
const shorthand = { Symbol };
type MissingSymbol = Symbol;


//// [missingSymbolLibraryDiagnostic.js]
"use strict";
Symbol("value");
const shorthand = { Symbol };
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//// [tests/cases/compiler/missingSymbolLibraryDiagnostic.ts] ////

=== missingSymbolLibraryDiagnostic.ts ===
interface Array<T> {}
>Array : Symbol(Array, Decl(missingSymbolLibraryDiagnostic.ts, 0, 0))
>T : Symbol(T, Decl(missingSymbolLibraryDiagnostic.ts, 0, 16))

interface Boolean {}
>Boolean : Symbol(Boolean, Decl(missingSymbolLibraryDiagnostic.ts, 0, 21))

interface Function {}
>Function : Symbol(Function, Decl(missingSymbolLibraryDiagnostic.ts, 1, 20))

interface CallableFunction extends Function {}
>CallableFunction : Symbol(CallableFunction, Decl(missingSymbolLibraryDiagnostic.ts, 2, 21))
>Function : Symbol(Function, Decl(missingSymbolLibraryDiagnostic.ts, 1, 20))

interface NewableFunction extends Function {}
>NewableFunction : Symbol(NewableFunction, Decl(missingSymbolLibraryDiagnostic.ts, 3, 46))
>Function : Symbol(Function, Decl(missingSymbolLibraryDiagnostic.ts, 1, 20))

interface IArguments {}
>IArguments : Symbol(IArguments, Decl(missingSymbolLibraryDiagnostic.ts, 4, 45))

interface Number {}
>Number : Symbol(Number, Decl(missingSymbolLibraryDiagnostic.ts, 5, 23))

interface Object {}
>Object : Symbol(Object, Decl(missingSymbolLibraryDiagnostic.ts, 6, 19))

interface RegExp {}
>RegExp : Symbol(RegExp, Decl(missingSymbolLibraryDiagnostic.ts, 7, 19))

interface String {}
>String : Symbol(String, Decl(missingSymbolLibraryDiagnostic.ts, 8, 19))

Symbol("value");
const shorthand = { Symbol };
>shorthand : Symbol(shorthand, Decl(missingSymbolLibraryDiagnostic.ts, 12, 5))
>Symbol : Symbol(Symbol, Decl(missingSymbolLibraryDiagnostic.ts, 12, 19))

type MissingSymbol = Symbol;
>MissingSymbol : Symbol(MissingSymbol, Decl(missingSymbolLibraryDiagnostic.ts, 12, 29))
>Symbol : Symbol(Symbol)

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//// [tests/cases/compiler/missingSymbolLibraryDiagnostic.ts] ////

=== missingSymbolLibraryDiagnostic.ts ===
interface Array<T> {}
interface Boolean {}
interface Function {}
interface CallableFunction extends Function {}
interface NewableFunction extends Function {}
interface IArguments {}
interface Number {}
interface Object {}
interface RegExp {}
interface String {}

Symbol("value");
>Symbol("value") : any
>Symbol : any
>"value" : "value"

const shorthand = { Symbol };
>shorthand : { Symbol: any; }
>{ Symbol } : { Symbol: any; }
>Symbol : any

type MissingSymbol = Symbol;
>MissingSymbol : Symbol

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @noLib: true

interface Array<T> {}
interface Boolean {}
interface Function {}
interface CallableFunction extends Function {}
interface NewableFunction extends Function {}
interface IArguments {}
interface Number {}
interface Object {}
interface RegExp {}
interface String {}

Symbol("value");
const shorthand = { Symbol };
type MissingSymbol = Symbol;
Loading