Skip to content

Commit 7b8fa9f

Browse files
committed
fix lint
1 parent dfd5678 commit 7b8fa9f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

README-zh_CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4021,9 +4021,9 @@ NoInfer 是一种实用类型,旨在阻止泛型函数范围内类型的自动
40214021
```typescript
40224022
// 泛型函数范围内类型的自动推断。
40234023
function fn<T extends string>(x: T[], y: T) {
4024-
return x.concat(y);
4024+
return x.concat(y);
40254025
}
4026-
const r = fn(["a", "b"], "c"); // 此处的类型为 ("a" | "b" | "c")[]
4026+
const r = fn(['a', 'b'], 'c'); // 此处的类型为 ("a" | "b" | "c")[]
40274027
```
40284028

40294029
使用 NoInfer

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4054,20 +4054,20 @@ Example:
40544054
```typescript
40554055
// Automatic inference of types within the scope of a generic function.
40564056
function fn<T extends string>(x: T[], y: T) {
4057-
return x.concat(y);
4057+
return x.concat(y);
40584058
}
4059-
const r = fn(["a", "b"], "c"); // Type here is ("a" | "b" | "c")[]
4059+
const r = fn(['a', 'b'], 'c'); // Type here is ("a" | "b" | "c")[]
40604060
```
40614061

40624062
With NoInfer:
40634063

40644064
```typescript
40654065
// Example function that uses NoInfer to prevent type inference
40664066
function fn2<T extends string>(x: T[], y: NoInfer<T>) {
4067-
return x.concat(y);
4067+
return x.concat(y);
40684068
}
40694069

4070-
const r2 = fn2(["a", "b"], "c"); // Error: Type Argument of type '"c"' is not assignable to parameter of type '"a" | "b"'.
4070+
const r2 = fn2(['a', 'b'], 'c'); // Error: Type Argument of type '"c"' is not assignable to parameter of type '"a" | "b"'.
40714071
```
40724072

40734073
## Others
@@ -5014,5 +5014,5 @@ with dynamic import:
50145014

50155015
<!-- skip -->
50165016
```typescript
5017-
const config = import("./config.json", { with: { type: "json" } })
5017+
const config = import('./config.json', { with: { type: 'json' } });
50185018
```

0 commit comments

Comments
 (0)