File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -339,11 +339,11 @@ packages
339339首先,任何 JSON 文件导入都需要包含 ` type: "json" ` 的导入属性。
340340
341341``` typescript
342- import myConfig from " ./myConfig.json" ;
342+ import myConfig from ' ./myConfig.json' ;
343343// ~~~~~~~~~~~~~~~~~
344344// ❌ 错误:当 'module' 设置为 'NodeNext' 时,将 JSON 文件导入 ECMAScript 模块需要 'type: "json"' 导入属性。
345345
346- import myConfig from " ./myConfig.json" with { type: " json" };
346+ import myConfig from ' ./myConfig.json' with { type: ' json' };
347347// ^^^^^^^^^^^^^^^^
348348// ✅ 这是可以的,因为我们提供了 `type: "json"`
349349```
@@ -352,12 +352,12 @@ import myConfig from "./myConfig.json" with { type: "json" };
352352
353353``` typescript
354354// ✅ 这是可以的:
355- import myConfigA from " ./myConfig.json" with { type: " json" };
355+ import myConfigA from ' ./myConfig.json' with { type: ' json' };
356356let version = myConfigA .version ;
357357
358358// /////////
359359
360- import * as myConfigB from " ./myConfig.json" with { type: " json" };
360+ import * as myConfigB from ' ./myConfig.json' with { type: ' json' };
361361
362362// ❌ 这是不可以的:
363363let version = myConfig .version ;
@@ -420,7 +420,7 @@ error TS2345: Argument of type 'Buffer' is not assignable to parameter of type '
420420
421421那么,您可能需要更新 ` @types/node ` 。
422422
423- 您可以在[ GitHub 上阅读有关此更改的具体内容] ( https://github.com/microsoft/TypeScript/pull/59417 ) 。
423+ 您可以在[ GitHub 上阅读有关此更改的具体内容] ( https://github.com/microsoft/TypeScript/pull/59417 ) 。
424424
425425### 在类中使用非字面量方法名创建索引签名
426426
Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ export function drawButton(options: Options): void;
217217这也包括 ` UInt8Array ` 的子类型,例如 Node.js 中的 ` Buffer ` 。
218218因此,你将看到如下新错误消息:
219219
220- ```
220+ ``` txt
221221error TS2345: Argument of type 'ArrayBufferLike' is not assignable to parameter of type 'BufferSource'.
222222error TS2322: Type 'ArrayBufferLike' is not assignable to type 'ArrayBuffer'.
223223error TS2322: Type 'Buffer' is not assignable to type 'Uint8Array<ArrayBufferLike>'.
@@ -228,7 +228,7 @@ error TS2345: Argument of type 'Buffer' is not assignable to parameter of type '
228228如果你遇到 ` Buffer ` 相关问题,你可能首先需要检查是否使用了最新版本的 ` @types/node ` 包。
229229这可能包括运行
230230
231- ```
231+ ``` sh
232232npm update @types/node --save-dev
233233```
234234
You can’t perform that action at this time.
0 commit comments