Last active
April 22, 2024 13:52
-
-
Save regevbr/57f3b4d798fb4642eb4a1c6ed667320d to your computer and use it in GitHub Desktop.
scaffold type safe get function up to a desired order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// tslint:disable:max-line-length | |
// based on https://www.reddit.com/r/typescript/comments/aynx0o/safe_deep_property_access_in_typescript | |
import * as fs from 'fs'; | |
const method = 'getProp'; | |
const TAB = ` `; | |
const generateNonNullable = (level: number): string => { | |
if (level === 0) { | |
return 'T'; | |
} | |
const key = level > 1 ? `[K${level - 1}]` : ''; | |
return `NonNullable<${generateNonNullable(level - 1)}${key}>`; | |
}; | |
const generateKN = (index: number) => { | |
return `K${index} extends keyof ${generateNonNullable(index)}`; | |
}; | |
const generateShortNonNullable = (level: number): string => { | |
if (level === 1) { | |
return 'T'; | |
} | |
const key = level > 1 ? `[K${level - 1}]` : ''; | |
return `NonNullable<${generateShortNonNullable(level - 1)}>${key}`; | |
}; | |
const generateMaybeUndef = (index: number) => { | |
return `MaybeUndefined<${generateShortNonNullable(index)}>`; | |
}; | |
const generateGetOverloadCode = (order: number) => { | |
let result = `export function ${method}<T,\n`; | |
for (let i = 1; i < order; i++) { | |
result += `${TAB}${generateKN(i)},\n`; | |
} | |
result += `${TAB}${generateKN(order)}>(\n`; | |
result += `${TAB}obj: T`; | |
for (let i = 1; i <= order; i++) { | |
result += `, k${i}: K${i}`; | |
} | |
result += `):\n`; | |
result += `${TAB}MaybeUndefined<T> |\n`; | |
for (let i = 2; i <= order; i++) { | |
result += `${TAB}${generateMaybeUndef(i)} |\n`; | |
} | |
result += `${TAB}${generateNonNullable(order)}[K${order}];`; | |
return result; | |
}; | |
const generateCode = (toOrder: number) => { | |
let result = `'use strict'; | |
// tslint:disable:max-line-length\n\n`; | |
result += `export type MaybeUndefined<T> = T extends null | undefined ? undefined : never;\n\n`; | |
for (let i = 1; i <= toOrder; i++) { | |
result += `${generateGetOverloadCode(i)}\n`; | |
} | |
result += `export function ${method}(obj: any, ...keys: string[]): any { | |
${TAB}return keys.reduce((result, key) => (result === null || result === undefined) ? undefined : result[key], obj); | |
}\n`; | |
return result; | |
}; | |
fs.writeFileSync(`./${method}.ts`, generateCode(15), 'utf-8'); | |
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// tslint:disable:max-line-length | |
// based on https://www.reddit.com/r/typescript/comments/aynx0o/safe_deep_property_access_in_typescript | |
import * as fs from 'fs'; | |
const method = 'getPropOr'; | |
const TAB = ` `; | |
const generateNonNullable = (level: number): string => { | |
if (level === 0) { | |
return 'T'; | |
} | |
const key = level > 1 ? `[K${level - 1}]` : ''; | |
return `NonNullable<${generateNonNullable(level - 1)}${key}>`; | |
}; | |
const generateKN = (index: number) => { | |
return `K${index} extends keyof ${generateNonNullable(index)}`; | |
}; | |
const generateGetOverloadCode = (order: number) => { | |
let result = `export function ${method}<T,\n`; | |
for (let i = 1; i < order; i++) { | |
result += `${TAB}${generateKN(i)},\n`; | |
} | |
const resultType = `NonNullable<${generateNonNullable(order)}[K${order}]>`; | |
result += `${TAB}${generateKN(order)}>(\n`; | |
result += `${TAB}obj: T, defaultValue: ${resultType} | (() => ${resultType}),\n${TAB}`; | |
for (let i = 1; i < order; i++) { | |
result += `k${i}: K${i}, `; | |
} | |
result += `k${order}: K${order}`; | |
result += `):\n`; | |
result += `${TAB}${resultType};`; | |
return result; | |
}; | |
const generateCode = (toOrder: number) => { | |
let result = `'use strict'; | |
import * as _ from 'underscore'; | |
// tslint:disable:max-line-length\n\n`; | |
for (let i = 1; i <= toOrder; i++) { | |
result += `${generateGetOverloadCode(i)}\n`; | |
} | |
result += `export function ${method}(obj: any, defaultValue: any, ...keys: string[]): any { | |
${TAB}const result = keys.reduce((acc, key) => (acc === null || acc === undefined) ? undefined : acc[key], obj); | |
${TAB}return (result === null || result === undefined) ? (_.isFunction(defaultValue) ? defaultValue() : defaultValue) : result; | |
}\n`; | |
return result; | |
}; | |
fs.writeFileSync(`./${method}.ts`, generateCode(15), 'utf-8'); | |
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// tslint:disable:max-line-length | |
export type MaybeUndefined<T> = T extends null | undefined ? undefined : never; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>>( | |
obj: T, k1: K1): | |
MaybeUndefined<T> | | |
NonNullable<T>[K1]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>>( | |
obj: T, k1: K1, k2: K2): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
NonNullable<NonNullable<T>[K1]>[K2]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>>( | |
obj: T, k1: K1, k2: K2, k3: K3): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>, | |
K12 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11, k12: K12): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>, | |
K12 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>, | |
K13 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11, k12: K12, k13: K13): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>, | |
K12 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>, | |
K13 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>, | |
K14 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11, k12: K12, k13: K13, k14: K14): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]; | |
export function getProp<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>, | |
K12 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>, | |
K13 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>, | |
K14 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>, | |
K15 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]>>( | |
obj: T, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11, k12: K12, k13: K13, k14: K14, k15: K15): | |
MaybeUndefined<T> | | |
MaybeUndefined<NonNullable<T>[K1]> | | |
MaybeUndefined<NonNullable<NonNullable<T>[K1]>[K2]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]> | | |
MaybeUndefined<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]> | | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]>[K15]; | |
export function getProp(obj: any, ...keys: string[]): any { | |
return keys.reduce((result, key) => (result === null || result === undefined) ? undefined : result[key], obj); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import * as _ from 'underscore'; | |
// tslint:disable:max-line-length | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>>( | |
obj: T, defaultValue: NonNullable<NonNullable<T>[K1]> | (() => NonNullable<NonNullable<T>[K1]>), | |
k1: K1): | |
NonNullable<NonNullable<T>[K1]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<T>[K1]>[K2]> | (() => NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>), | |
k1: K1, k2: K2): | |
NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>), | |
k1: K1, k2: K2, k3: K3): | |
NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>), | |
k1: K1, k2: K2, k3: K3, k4: K4): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>, | |
K12 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11, k12: K12): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>, | |
K12 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>, | |
K13 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11, k12: K12, k13: K13): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>, | |
K12 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>, | |
K13 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>, | |
K14 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11, k12: K12, k13: K13, k14: K14): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]>; | |
export function getPropOr<T, | |
K1 extends keyof NonNullable<T>, | |
K2 extends keyof NonNullable<NonNullable<T>[K1]>, | |
K3 extends keyof NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>, | |
K4 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>, | |
K5 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>, | |
K6 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>, | |
K7 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, | |
K8 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>, | |
K9 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>, | |
K10 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>, | |
K11 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>, | |
K12 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>, | |
K13 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>, | |
K14 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>, | |
K15 extends keyof NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]>>( | |
obj: T, defaultValue: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]>[K15]> | (() => NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]>[K15]>), | |
k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, k8: K8, k9: K9, k10: K10, k11: K11, k12: K12, k13: K13, k14: K14, k15: K15): | |
NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>[K8]>[K9]>[K10]>[K11]>[K12]>[K13]>[K14]>[K15]>; | |
export function getPropOr(obj: any, defaultValue: any, ...keys: string[]): any { | |
const result = keys.reduce((acc, key) => (acc === null || acc === undefined) ? undefined : acc[key], obj); | |
return (result === null || result === undefined) ? (_.isFunction(defaultValue) ? defaultValue() : defaultValue) : result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment