我收到这个错误。不知道从哪里来。
theultimateprepper-api | Warning Implicitly using master branch https://deno.land/std/node/_fs/_fs_readlink.ts
theultimateprepper-api | Check file:///app/app.ts
theultimateprepper-api | error: TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
theultimateprepper-api | Type 'URL' is not assignable to type 'string'.
theultimateprepper-api | return new URL(url).pathname
theultimateprepper-api | ~~~
theultimateprepper-api | at https://deno.land/std@v0.50.0/path/win32.ts:911:18
theultimateprepper-api |
theultimateprepper-api | TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
theultimateprepper-api | Type 'URL' is not assignable to type 'string'.
theultimateprepper-api | return new URL(url).pathname;
theultimateprepper-api | ~~~
theultimateprepper-api | at https://deno.land/std@v0.50.0/path/posix.ts:433:18
theultimateprepper-api |
theultimateprepper-api | Found 2 errors.
Run Code Online (Sandbox Code Playgroud)
您可能正在使用已更新URL构造函数的新版本 Deno 。
比较std@v0.50.0和std@masterfromFileUrl中的实现:
// v0.50.0
export function fromFileUrl(url: string | URL): string {
return new URL(url).pathname; // <---- this line
}
// master
export function fromFileUrl(url: string | URL): string {
url = url instanceof URL ? url : new URL(url); // <---- and this line
if (url.protocol != "file:") {
throw new TypeError("Must be a file URL.");
}
return decodeURIComponent(url.pathname);
}
Run Code Online (Sandbox Code Playgroud)
处理方式发生了变化。
请使用与您正在使用的 Deno 版本兼容的更新版本的 Deno 标准模块(例如 std@v0.62.0)。您可以在https://github.com/denoland/deno/tags找到发行版本
(找到正确的版本是令人沮丧的,这是可以理解的,但由于标准模块仍然标记为 0.x,这意味着它们尚未完全稳定,因此以与 Deno 二进制文件本身不同的方式发布)
| 归档时间: |
|
| 查看次数: |
6240 次 |
| 最近记录: |