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
Is your feature request related to a real problem or use-case?
Remove index signature from T. Some libraries return type with index signatures. For example in yargs
const yargsSchema = yargs(process.argv.slice(2)).options({
MY: { type: 'string', default: 'SOME' },
})
yargsSchema.argv['MY'] // Ok, and have autocomplete for this property
yargsSchema.argv['UNKNOWN'] // This property doesn't exist, but I still can access it without errors
Describe a solution including usage in code example
type KnownKeys<T> = {
[K in keyof T]: string extends K ? never : number extends K ? never : K
} extends { [_ in keyof T]: infer U } ? U : never;
type FooWithOnlyBar = Pick<Foo, KnownKeys<Foo>>;
Who does this impact? Who is this for?
All TypeScript users
The text was updated successfully, but these errors were encountered:
Is your feature request related to a real problem or use-case?
Remove index signature from
T
. Some libraries return type with index signatures. For example inyargs
Describe a solution including usage in code example
There is a proposed solution on StackOverflow https://stackoverflow.com/a/51956054/3021445
Would be nice to have this here as well in
utility-types
Who does this impact? Who is this for?
All TypeScript users
The text was updated successfully, but these errors were encountered: