mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Add predefined mapped types and revise Object.freeze
This commit is contained in:
parent
fe3f88cd08
commit
d32196ff36
30
src/lib/es5.d.ts
vendored
30
src/lib/es5.d.ts
vendored
@ -180,7 +180,7 @@ interface ObjectConstructor {
|
||||
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
|
||||
* @param o Object on which to lock the attributes.
|
||||
*/
|
||||
freeze<T>(o: T): T;
|
||||
freeze<T>(o: T): Readonly<T>;
|
||||
|
||||
/**
|
||||
* Prevents the addition of new properties to an object.
|
||||
@ -1343,6 +1343,34 @@ interface ArrayLike<T> {
|
||||
readonly [n: number]: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make all properties in T optional
|
||||
*/
|
||||
type Partial<T> = {
|
||||
[P in keyof T]?: T[P];
|
||||
};
|
||||
|
||||
/**
|
||||
* Make all properties in T readonly
|
||||
*/
|
||||
type Readonly<T> = {
|
||||
readonly [P in keyof T]: T[P];
|
||||
};
|
||||
|
||||
/**
|
||||
* From T pick a set of properties K
|
||||
*/
|
||||
type Pick<T, K extends keyof T> = {
|
||||
[P in K]: T[P];
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a type with a set of properties K of type T
|
||||
*/
|
||||
type Record<K extends string | number, T> = {
|
||||
[P in K]: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a raw buffer of binary data, which is used to store data for the
|
||||
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user