-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29766 from Microsoft/USE-ALL-THE-ES2015-NAMES-WES…
…LEY-WHAT-IS-SO-HARD-ABOUT-THAT Expand "set your lib" suggestions to other commonly used ES2015 declarations
- Loading branch information
Showing
6 changed files
with
175 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
tests/baselines/reference/forwardDeclaredCommonTypes01.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
tests/cases/compiler/forwardDeclaredCommonTypes01.ts(9,9): error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
tests/cases/compiler/forwardDeclaredCommonTypes01.ts(10,9): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
tests/cases/compiler/forwardDeclaredCommonTypes01.ts(10,17): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
tests/cases/compiler/forwardDeclaredCommonTypes01.ts(11,9): error TS2585: 'Map' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
tests/cases/compiler/forwardDeclaredCommonTypes01.ts(12,9): error TS2585: 'WeakMap' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
tests/cases/compiler/forwardDeclaredCommonTypes01.ts(13,9): error TS2585: 'Set' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
tests/cases/compiler/forwardDeclaredCommonTypes01.ts(14,9): error TS2585: 'WeakSet' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
|
||
|
||
==== tests/cases/compiler/forwardDeclaredCommonTypes01.ts (7 errors) ==== | ||
interface Promise<T> {} | ||
interface Symbol {} | ||
interface Map<K, V> {} | ||
interface WeakMap<K extends object, V> {} | ||
interface Set<T> {} | ||
interface WeakSet<T extends object> {} | ||
|
||
(function() { | ||
new Promise; | ||
~~~~~~~ | ||
!!! error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
new Symbol; Symbol(); | ||
~~~~~~ | ||
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
~~~~~~ | ||
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
new Map; | ||
~~~ | ||
!!! error TS2585: 'Map' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
new WeakMap; | ||
~~~~~~~ | ||
!!! error TS2585: 'WeakMap' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
new Set; | ||
~~~ | ||
!!! error TS2585: 'Set' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
new WeakSet; | ||
~~~~~~~ | ||
!!! error TS2585: 'WeakSet' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//// [forwardDeclaredCommonTypes01.ts] | ||
interface Promise<T> {} | ||
interface Symbol {} | ||
interface Map<K, V> {} | ||
interface WeakMap<K extends object, V> {} | ||
interface Set<T> {} | ||
interface WeakSet<T extends object> {} | ||
|
||
(function() { | ||
new Promise; | ||
new Symbol; Symbol(); | ||
new Map; | ||
new WeakMap; | ||
new Set; | ||
new WeakSet; | ||
}); | ||
|
||
|
||
//// [forwardDeclaredCommonTypes01.js] | ||
(function () { | ||
new Promise; | ||
new Symbol; | ||
Symbol(); | ||
new Map; | ||
new WeakMap; | ||
new Set; | ||
new WeakSet; | ||
}); |
35 changes: 35 additions & 0 deletions
35
tests/baselines/reference/forwardDeclaredCommonTypes01.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
=== tests/cases/compiler/forwardDeclaredCommonTypes01.ts === | ||
interface Promise<T> {} | ||
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(forwardDeclaredCommonTypes01.ts, 0, 0)) | ||
>T : Symbol(T, Decl(lib.es5.d.ts, --, --), Decl(forwardDeclaredCommonTypes01.ts, 0, 18)) | ||
|
||
interface Symbol {} | ||
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(forwardDeclaredCommonTypes01.ts, 0, 23)) | ||
|
||
interface Map<K, V> {} | ||
>Map : Symbol(Map, Decl(forwardDeclaredCommonTypes01.ts, 1, 19)) | ||
>K : Symbol(K, Decl(forwardDeclaredCommonTypes01.ts, 2, 14)) | ||
>V : Symbol(V, Decl(forwardDeclaredCommonTypes01.ts, 2, 16)) | ||
|
||
interface WeakMap<K extends object, V> {} | ||
>WeakMap : Symbol(WeakMap, Decl(forwardDeclaredCommonTypes01.ts, 2, 22)) | ||
>K : Symbol(K, Decl(forwardDeclaredCommonTypes01.ts, 3, 18)) | ||
>V : Symbol(V, Decl(forwardDeclaredCommonTypes01.ts, 3, 35)) | ||
|
||
interface Set<T> {} | ||
>Set : Symbol(Set, Decl(forwardDeclaredCommonTypes01.ts, 3, 41)) | ||
>T : Symbol(T, Decl(forwardDeclaredCommonTypes01.ts, 4, 14)) | ||
|
||
interface WeakSet<T extends object> {} | ||
>WeakSet : Symbol(WeakSet, Decl(forwardDeclaredCommonTypes01.ts, 4, 19)) | ||
>T : Symbol(T, Decl(forwardDeclaredCommonTypes01.ts, 5, 18)) | ||
|
||
(function() { | ||
new Promise; | ||
new Symbol; Symbol(); | ||
new Map; | ||
new WeakMap; | ||
new Set; | ||
new WeakSet; | ||
}); | ||
|
40 changes: 40 additions & 0 deletions
40
tests/baselines/reference/forwardDeclaredCommonTypes01.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
=== tests/cases/compiler/forwardDeclaredCommonTypes01.ts === | ||
interface Promise<T> {} | ||
interface Symbol {} | ||
interface Map<K, V> {} | ||
interface WeakMap<K extends object, V> {} | ||
interface Set<T> {} | ||
interface WeakSet<T extends object> {} | ||
|
||
(function() { | ||
>(function() { new Promise; new Symbol; Symbol(); new Map; new WeakMap; new Set; new WeakSet;}) : () => void | ||
>function() { new Promise; new Symbol; Symbol(); new Map; new WeakMap; new Set; new WeakSet;} : () => void | ||
|
||
new Promise; | ||
>new Promise : any | ||
>Promise : any | ||
|
||
new Symbol; Symbol(); | ||
>new Symbol : any | ||
>Symbol : any | ||
>Symbol() : any | ||
>Symbol : any | ||
|
||
new Map; | ||
>new Map : any | ||
>Map : any | ||
|
||
new WeakMap; | ||
>new WeakMap : any | ||
>WeakMap : any | ||
|
||
new Set; | ||
>new Set : any | ||
>Set : any | ||
|
||
new WeakSet; | ||
>new WeakSet : any | ||
>WeakSet : any | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// @lib: es5 | ||
// @target: es5 | ||
|
||
interface Promise<T> {} | ||
interface Symbol {} | ||
interface Map<K, V> {} | ||
interface WeakMap<K extends object, V> {} | ||
interface Set<T> {} | ||
interface WeakSet<T extends object> {} | ||
|
||
(function() { | ||
new Promise; | ||
new Symbol; Symbol(); | ||
new Map; | ||
new WeakMap; | ||
new Set; | ||
new WeakSet; | ||
}); |