sindresorhus / type-fest

A collection of essential TypeScript types
Creative Commons Zero v1.0 Universal
14.36k stars 545 forks source link

`keyof` for Map #225

Open fregante opened 3 years ago

fregante commented 3 years ago

Context: https://stackoverflow.com/q/60737502

const obj = {first: 'First Name', last: 'Last Name'};
type Keys = keyof typeof obj; // first | last
const map = new Map([
    [first, 'First Name'],
    [last: 'Last Name']
]);
type Keys = ????????

Upvote & Fund

Fund with Polar

sindresorhus commented 3 years ago

👍

fregante commented 3 years ago
fregante commented 3 months ago

I think this exists as MapKey, but is not exported.