docs(invert): Ensure JSDoc visibility for invert function (#145)

This commit is contained in:
Dongho Kim 2024-07-09 23:57:25 +09:00 committed by GitHub
parent 3d64af3aab
commit 23f31e748c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,9 +16,6 @@
* invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' } * invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }
* invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' } * invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }
*/ */
type PropertyKey = string | number | symbol;
export function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } { export function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } {
const result = {} as { [key in V]: K }; const result = {} as { [key in V]: K };