mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 08:33:43 -05:00
fix(check): do not suggest running with --unstable
(#23092)
Closes #23079
This commit is contained in:
parent
feb744cebd
commit
49f97d5f85
6 changed files with 38 additions and 2 deletions
|
@ -354,7 +354,7 @@ delete Object.prototype.__proto__;
|
|||
case 2339: {
|
||||
const property = getProperty();
|
||||
if (property && unstableDenoProps.has(property)) {
|
||||
return `${msg} 'Deno.${property}' is an unstable API. Did you forget to run with the '--unstable' flag? ${unstableMsgSuggestion}`;
|
||||
return `${msg} 'Deno.${property}' is an unstable API. ${unstableMsgSuggestion}`;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ delete Object.prototype.__proto__;
|
|||
if (property && unstableDenoProps.has(property)) {
|
||||
const suggestion = getMsgSuggestion();
|
||||
if (suggestion) {
|
||||
return `${msg} 'Deno.${property}' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean '${suggestion}'? ${unstableMsgSuggestion}`;
|
||||
return `${msg} 'Deno.${property}' is an unstable API. Did you mean '${suggestion}'? ${unstableMsgSuggestion}`;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
|
|
11
tests/specs/check/unstable_suggestion/__test__.jsonc
Normal file
11
tests/specs/check/unstable_suggestion/__test__.jsonc
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"steps": [{
|
||||
"args": "check main.ts",
|
||||
"output": "main.out",
|
||||
"exitCode": 1
|
||||
}, {
|
||||
"args": "check no_default_lib.ts",
|
||||
"output": "no_default_lib.out",
|
||||
"exitCode": 1
|
||||
}]
|
||||
}
|
10
tests/specs/check/unstable_suggestion/main.out
Normal file
10
tests/specs/check/unstable_suggestion/main.out
Normal file
|
@ -0,0 +1,10 @@
|
|||
Check file:///[WILDLINE]main.ts
|
||||
error: TS2551 [ERROR]: Property 'dlopen' does not exist on type 'typeof Deno'. Did you mean 'open'? 'Deno.dlopen' is an unstable API. Did you mean 'open'? If not, try changing the 'lib' compiler option to include 'deno.unstable' or add a triple-slash directive to the top of your entrypoint (main file): /// <reference lib="deno.unstable" />
|
||||
Deno.dlopen("path/to/lib", {});
|
||||
~~~~~~
|
||||
at file:///[WILDLINE]/main.ts:5:6
|
||||
|
||||
'open' is declared here.
|
||||
export function open(
|
||||
~~~~
|
||||
at asset:///lib.deno.ns.d.ts:[WILDLINE]
|
5
tests/specs/check/unstable_suggestion/main.ts
Normal file
5
tests/specs/check/unstable_suggestion/main.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
// unstable apis removed here, so should error
|
||||
Deno.dlopen("path/to/lib", {});
|
5
tests/specs/check/unstable_suggestion/no_default_lib.out
Normal file
5
tests/specs/check/unstable_suggestion/no_default_lib.out
Normal file
|
@ -0,0 +1,5 @@
|
|||
Check file:///[WILDLINE]/no_default_lib.ts
|
||||
error: TS2304 [ERROR]: Cannot find name 'Deno'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'deno.ns' or add a triple-slash directive to the top of your entrypoint (main file): /// <reference lib="deno.ns" />
|
||||
console.log(Deno);
|
||||
~~~~
|
||||
at file:///[WILDLINE]/no_default_lib.ts:5:13
|
5
tests/specs/check/unstable_suggestion/no_default_lib.ts
Normal file
5
tests/specs/check/unstable_suggestion/no_default_lib.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="es5" />
|
||||
/// <reference lib="dom" />
|
||||
|
||||
console.log(Deno);
|
Loading…
Reference in a new issue