basarat / basarat/typescript-book

Wrong: All members must conform to the string index signature?

Open
#618 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

[origin](https://basarat.gitbook.io/typescript/type-system/index-signatures#all-members-must-conform-to-the-string-index-signature)

i copied the Foo and Bar into ts playground and it works.

```typescript
interface Foo {x:number; y:string}
const index: 'x'|'y' = fromSomewhere;
const foo1: Foo = { x:1, y:"a b c"}
const bar: string | number = foo1[index];
```

Contributor guide

Open the contributing guide

Research direction

Read the linked index-signatures section and reproduce the Foo/Bar snippet in the TypeScript playground. Compare the playground result with the section's claim, then update the relevant documentation so the example and explanation agree; done means the documented behavior matches the verified result.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.