GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Generic index into two types not seen as assignable, even if the two types are identical for all relevant keys · Issue #58905 · microsoft/TypeScript Closed as not planned Closed as not planned Copy link Labels Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed Description🔎 Search Termsgeneric, indexed access, supertype 🕗 Version & Regression Information
⏯ Playground Link💻 Codeinterface Foo { a: string, b: number } interface Bar extends Foo { c: boolean } function bar<K extends keyof Bar>(k: K, v: Bar[K]) { } function foo<K extends keyof Foo>(k: K, v: Foo[K]) { bar(k, v) // error! // ~ // Argument of type 'Foo[K]' is not assignable to parameter of type 'Bar[K]'. // Property 'c' is missing in type 'Foo' but required in type 'Bar'.(2345) } 🙁 Actual behavior
🙂 Expected behavior
Additional information about the issueThis is presumably a design limitation introduced with #30769. And while it's similar to #32693, it's different enough that I'd like to see an official word about it. If there is an existing issue that's the same as this, I didn't find it. Can anyone find one this duplicates? I'm investigating a SO question and while I feel certain I've seen this before, I keep hitting things like #32693 which aren't about generics at all. On the face of it, if Activity
MetadataMetadataAssigneesLabelsDesign LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |