You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
extends keyof does not allow extended new keys on interfaces since 4.3.0Β #44295
I saw this in 4.3.0 beta, it seems to exists in the nightly. It was working on 4.2.x
β― Playground Link
exportinterfaceGlobalOptions{// cannot be added or it wouldn't be able to be extended// suffix: string}// this is added by a user to extend a global customizationexportinterfaceGlobalOptions{// suffix: 'New'}exporttypeWithSuffix<Sextendsstring>= `${S}${'suffix'extendskeyofGlobalOptions ? GlobalOptions['suffix'] : 'Suffix'}`
declareleta: WithSuffix<'hi'>
changed the title [-]extends `keyof` does not allow extended new keys on interfaces[/-][+]extends `keyof` does not allow extended new keys on interfaces since 4.3.0[/+]on May 31, 2021
Activity
[-]extends `keyof` does not allow extended new keys on interfaces[/-][+]extends `keyof` does not allow extended new keys on interfaces since 4.3.0[/+]RyanCavanaugh commentedon Jun 2, 2021
The idiomatic way to write this would be
which works as expected.
The "narrowing" of the RHS in that position was a bug and shouldn't have happened.
posva commentedon Jun 3, 2021
Thanks a lot for telling me the correct way of doing it!