source: node_modules/ts-toolbelt/out/Object/P/Readonly.d.ts@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 988 bytes
Line 
1import { Key } from '../../Any/Key';
2import { Readonly as OReadonly } from '../Readonly';
3import { List } from '../../List/List';
4import { BuiltIn } from '../../Misc/BuiltIn';
5import { Tail } from '../../List/Tail';
6import { Depth } from '../_Internal';
7/**
8 * @hidden
9 */
10declare type ReadonlyAt<O, Path extends List<Key>, depth extends Depth> = O extends BuiltIn ? O : Path extends [Key] ? O extends List ? OReadonly<O, Path[0], depth> : O extends object ? OReadonly<O, Path[0], depth> : O : {
11 [K in keyof O]: K extends Path[0] ? ReadonlyAt<O[K], Tail<Path>, depth> : O[K];
12};
13/**
14 * Make some fields of `O` readonly at `Path` (deeply or not)
15 * @param O to make readonly
16 * @param Path to be followed
17 * @param depth (?=`'flat'`) 'deep' to do it deeply
18 * @returns [[Object]]
19 * @example
20 * ```ts
21 * ```
22 */
23export declare type Readonly<O extends object, Path extends List<Key>, depth extends Depth = 'flat'> = Path extends unknown ? ReadonlyAt<O, Path, depth> : never;
24export {};
Note: See TracBrowser for help on using the repository browser.