3 ms·
"objectKeys" wrapper from https://github.com/sindresorhus/ts-extras https://github.com/sindresorhus/ts-extras also does this. It would be nice if the behaviour
by mpoc 3y ago
"objectKeys" wrapper from https://github.com/sindresorhus/ts-extras https://github.com/sindresorhus/ts-extras also does this.
It would be nice if the behaviour with "as const" was different:
const person = { name: 'John Doe', age: 35 } as const
const result = Object.keys(person) // return type is not 'name' | 'age'
- have_faith 3y agoThis was my first thought. I thought `as const` might have narrowed the type.