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 | |
---|
1 | import { Key } from '../../Any/Key';
|
---|
2 | import { Readonly as OReadonly } from '../Readonly';
|
---|
3 | import { List } from '../../List/List';
|
---|
4 | import { BuiltIn } from '../../Misc/BuiltIn';
|
---|
5 | import { Tail } from '../../List/Tail';
|
---|
6 | import { Depth } from '../_Internal';
|
---|
7 | /**
|
---|
8 | * @hidden
|
---|
9 | */
|
---|
10 | declare 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 | */
|
---|
23 | export declare type Readonly<O extends object, Path extends List<Key>, depth extends Depth = 'flat'> = Path extends unknown ? ReadonlyAt<O, Path, depth> : never;
|
---|
24 | export {};
|
---|
Note:
See
TracBrowser
for help on using the repository browser.