mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:46:28 -05:00
Give suggestion for @types/bun when Bun global is not found (#56795)
This commit is contained in:
@@ -26192,6 +26192,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return compilerOptions.types
|
||||
? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig
|
||||
: Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode;
|
||||
case "Bun":
|
||||
return compilerOptions.types
|
||||
? 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
|
||||
: Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun;
|
||||
case "Map":
|
||||
case "Set":
|
||||
case "Promise":
|
||||
|
||||
@@ -3735,6 +3735,14 @@
|
||||
"category": "Error",
|
||||
"code": 2866
|
||||
},
|
||||
"Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`.": {
|
||||
"category": "Error",
|
||||
"code": 2867
|
||||
},
|
||||
"Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig.": {
|
||||
"category": "Error",
|
||||
"code": 2868
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
||||
11
tests/baselines/reference/typingsSuggestionBun1.errors.txt
Normal file
11
tests/baselines/reference/typingsSuggestionBun1.errors.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
a.ts(1,14): error TS2868: Cannot find name 'Bun'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{ "compilerOptions": {"types": []} }
|
||||
|
||||
==== a.ts (1 errors) ====
|
||||
const file = Bun.file("/a.ts");
|
||||
~~~
|
||||
!!! error TS2868: Cannot find name 'Bun'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig.
|
||||
|
||||
8
tests/baselines/reference/typingsSuggestionBun1.js
Normal file
8
tests/baselines/reference/typingsSuggestionBun1.js
Normal file
@@ -0,0 +1,8 @@
|
||||
//// [tests/cases/conformance/typings/typingsSuggestionBun1.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
const file = Bun.file("/a.ts");
|
||||
|
||||
|
||||
//// [a.js]
|
||||
var file = Bun.file("/a.ts");
|
||||
6
tests/baselines/reference/typingsSuggestionBun1.symbols
Normal file
6
tests/baselines/reference/typingsSuggestionBun1.symbols
Normal file
@@ -0,0 +1,6 @@
|
||||
//// [tests/cases/conformance/typings/typingsSuggestionBun1.ts] ////
|
||||
|
||||
=== a.ts ===
|
||||
const file = Bun.file("/a.ts");
|
||||
>file : Symbol(file, Decl(a.ts, 0, 5))
|
||||
|
||||
11
tests/baselines/reference/typingsSuggestionBun1.types
Normal file
11
tests/baselines/reference/typingsSuggestionBun1.types
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [tests/cases/conformance/typings/typingsSuggestionBun1.ts] ////
|
||||
|
||||
=== a.ts ===
|
||||
const file = Bun.file("/a.ts");
|
||||
>file : any
|
||||
>Bun.file("/a.ts") : any
|
||||
>Bun.file : any
|
||||
>Bun : any
|
||||
>file : any
|
||||
>"/a.ts" : "/a.ts"
|
||||
|
||||
11
tests/baselines/reference/typingsSuggestionBun2.errors.txt
Normal file
11
tests/baselines/reference/typingsSuggestionBun2.errors.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
a.ts(1,14): error TS2867: Cannot find name 'Bun'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{ "compilerOptions": {} }
|
||||
|
||||
==== a.ts (1 errors) ====
|
||||
const file = Bun.file("/a.ts");
|
||||
~~~
|
||||
!!! error TS2867: Cannot find name 'Bun'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`.
|
||||
|
||||
8
tests/baselines/reference/typingsSuggestionBun2.js
Normal file
8
tests/baselines/reference/typingsSuggestionBun2.js
Normal file
@@ -0,0 +1,8 @@
|
||||
//// [tests/cases/conformance/typings/typingsSuggestionBun2.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
const file = Bun.file("/a.ts");
|
||||
|
||||
|
||||
//// [a.js]
|
||||
var file = Bun.file("/a.ts");
|
||||
6
tests/baselines/reference/typingsSuggestionBun2.symbols
Normal file
6
tests/baselines/reference/typingsSuggestionBun2.symbols
Normal file
@@ -0,0 +1,6 @@
|
||||
//// [tests/cases/conformance/typings/typingsSuggestionBun2.ts] ////
|
||||
|
||||
=== a.ts ===
|
||||
const file = Bun.file("/a.ts");
|
||||
>file : Symbol(file, Decl(a.ts, 0, 5))
|
||||
|
||||
11
tests/baselines/reference/typingsSuggestionBun2.types
Normal file
11
tests/baselines/reference/typingsSuggestionBun2.types
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [tests/cases/conformance/typings/typingsSuggestionBun2.ts] ////
|
||||
|
||||
=== a.ts ===
|
||||
const file = Bun.file("/a.ts");
|
||||
>file : any
|
||||
>Bun.file("/a.ts") : any
|
||||
>Bun.file : any
|
||||
>Bun : any
|
||||
>file : any
|
||||
>"/a.ts" : "/a.ts"
|
||||
|
||||
5
tests/cases/conformance/typings/typingsSuggestionBun1.ts
Normal file
5
tests/cases/conformance/typings/typingsSuggestionBun1.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// @filename: tsconfig.json
|
||||
{ "compilerOptions": {"types": []} }
|
||||
|
||||
// @filename: a.ts
|
||||
const file = Bun.file("/a.ts");
|
||||
5
tests/cases/conformance/typings/typingsSuggestionBun2.ts
Normal file
5
tests/cases/conformance/typings/typingsSuggestionBun2.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// @filename: tsconfig.json
|
||||
{ "compilerOptions": {} }
|
||||
|
||||
// @filename: a.ts
|
||||
const file = Bun.file("/a.ts");
|
||||
Reference in New Issue
Block a user