Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pages/Advanced Types.md
Original file line number Diff line number Diff line change
Expand Up @@ -773,14 +773,14 @@ let unknown = getProperty(person, 'unknown'); // error, 'unknown' is not in 'nam
## Index types and string index signatures

`keyof` and `T[K]` interact with string index signatures.
If you have a type with a string index signature, `keyof T` will just be `string`.
If you have a type with a string index signature, `keyof T` will just be `string[]`.
And `T[string]` is just the type of the index signature:

```ts
interface Map<T> {
[key: string]: T;
}
let keys: keyof Map<number>; // string
let keys: keyof Map<number>; // string[]
let value: Map<number>['foo']; // number
```

Expand Down