Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structural tag type brands #33290

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/built/local/**
/tests/**
/lib/**
/src/lib/*.generated.d.ts
/src/lib/*.generated.d.ts
# TODO: Remove once tag types are supported by eslint's TS parser
/src/lib/es5.d.ts
2 changes: 1 addition & 1 deletion lib/ko/diagnosticMessages.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@
"The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701": "개체 rest 할당의 대상은 변수 또는 속성 액세스여야 합니다.",
"The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684": "'{0}' 형식의 'this' 컨텍스트를 메서드의 '{1}' 형식 'this'에 할당할 수 없습니다.",
"The_this_types_of_each_signature_are_incompatible_2685": "각 시그니처의 'this' 형식이 호환되지 않습니다.",
"The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453": "형식 매개 변수 '{0}'의 형식 인수를 유추할 수 없습니다. 형식 인수를 명시적으로 지정하세요.",
"The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453": "사용량에서 형식 매개 변수 '{0}'의 형식 인수를 유추할 수 없습니다. 형식 인수를 명시적으로 지정하세요.",
"The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547": "비동기 반복기의 'next()' 메서드에서 반환하는 형식은 'value' 속성이 있는 형식에 대한 프라미스여야 합니다.",
"The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490": "반복기의 'next()' 메서드에 의해 반환되는 형식에는 'value' 속성이 있어야 합니다.",
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' 문의 변수 선언에 이니셜라이저가 포함될 수 없습니다.",
Expand Down
8 changes: 4 additions & 4 deletions lib/lib.es2015.collection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface Map<K, V> {

interface MapConstructor {
new(): Map<any, any>;
new<K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): Map<K, V>;
new<K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
readonly prototype: Map<any, any>;
}
declare var Map: MapConstructor;
Expand All @@ -50,7 +50,7 @@ interface WeakMap<K extends object, V> {
}

interface WeakMapConstructor {
new <K extends object = object, V = any>(entries?: ReadonlyArray<[K, V]> | null): WeakMap<K, V>;
new <K extends object = object, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
readonly prototype: WeakMap<object, any>;
}
declare var WeakMap: WeakMapConstructor;
Expand All @@ -65,7 +65,7 @@ interface Set<T> {
}

interface SetConstructor {
new <T = any>(values?: ReadonlyArray<T> | null): Set<T>;
new <T = any>(values?: readonly T[] | null): Set<T>;
readonly prototype: Set<any>;
}
declare var Set: SetConstructor;
Expand All @@ -83,7 +83,7 @@ interface WeakSet<T extends object> {
}

interface WeakSetConstructor {
new <T extends object = object>(values?: ReadonlyArray<T> | null): WeakSet<T>;
new <T extends object = object>(values?: readonly T[] | null): WeakSet<T>;
readonly prototype: WeakSet<object>;
}
declare var WeakSet: WeakSetConstructor;
14 changes: 7 additions & 7 deletions lib/lib.es2015.core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ interface ObjectConstructor {
getOwnPropertySymbols(o: any): symbol[];

/**
* Returns the names of the enumerable string properties and methods of an object.
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
* Returns the names of the enumerable string properties and methods of an object.
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
keys(o: {}): string[];

/**
Expand All @@ -332,7 +332,7 @@ interface ObjectConstructor {
is(value1: any, value2: any): boolean;

/**
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
* @param o The object to change its prototype.
* @param proto The value of the new prototype or null.
*/
Expand All @@ -349,8 +349,8 @@ interface ReadonlyArray<T> {
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find<S extends T>(predicate: (this: void, value: T, index: number, obj: ReadonlyArray<T>) => value is S, thisArg?: any): S | undefined;
find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => unknown, thisArg?: any): T | undefined;
find<S extends T>(predicate: (this: void, value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined;
find(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined;

/**
* Returns the index of the first element in the array where predicate is true, and -1
Expand All @@ -361,7 +361,7 @@ interface ReadonlyArray<T> {
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => unknown, thisArg?: any): number;
findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number;
}

interface RegExp {
Expand Down
2 changes: 1 addition & 1 deletion lib/lib.es2017.object.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface ObjectConstructor {
* Returns an array of values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
values<T>(o: { [s: string]: T } | ArrayLike<T>): T[];
values<T>(o: { [s: string]: T } | ArrayLike<T>): T[];

/**
* Returns an array of values of the enumerable properties of an object
Expand Down
6 changes: 3 additions & 3 deletions lib/lib.es2018.intl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ and limitations under the License.

declare namespace Intl {
interface PluralRulesOptions {
localeMatcher?: 'lookup' | 'best fit';
type?: 'cardinal' | 'ordinal';
localeMatcher?: "lookup" | "best fit";
type?: "cardinal" | "ordinal";
}

interface ResolvedPluralRulesOptions {
locale: string;
pluralCategories: string[];
type: 'cardinal' | 'ordinal';
type: "cardinal" | "ordinal";
minimumIntegerDigits: number;
minimumFractionDigits: number;
maximumFractionDigits: number;
Expand Down
6 changes: 3 additions & 3 deletions lib/lib.es2019.array.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface ReadonlyArray<T> {
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined> (
callback: (this: This, value: T, index: number, array: T[]) => U|ReadonlyArray<U>,
callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,
thisArg?: This
): U[]

Expand Down Expand Up @@ -130,7 +130,7 @@ interface ReadonlyArray<T> {
* @param depth The maximum recursion depth
*/
flat<U>(depth?: number): any[];
}
}

interface Array<T> {

Expand All @@ -145,7 +145,7 @@ interface Array<T> {
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined> (
callback: (this: This, value: T, index: number, array: T[]) => U|ReadonlyArray<U>,
callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,
thisArg?: This
): U[]

Expand Down
16 changes: 8 additions & 8 deletions lib/lib.es2019.string.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ and limitations under the License.


interface String {
/** Removes the trailing white space and line terminator characters from a string. */
trimEnd(): string;
/** Removes the trailing white space and line terminator characters from a string. */
trimEnd(): string;

/** Removes the leading white space and line terminator characters from a string. */
trimStart(): string;
/** Removes the leading white space and line terminator characters from a string. */
trimStart(): string;

/** Removes the leading white space and line terminator characters from a string. */
trimLeft(): string;
/** Removes the leading white space and line terminator characters from a string. */
trimLeft(): string;

/** Removes the trailing white space and line terminator characters from a string. */
trimRight(): string;
/** Removes the trailing white space and line terminator characters from a string. */
trimRight(): string;
}
12 changes: 6 additions & 6 deletions lib/lib.es2020.string.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ and limitations under the License.
/// <reference lib="es2015.iterable" />

interface String {
/**
* Matches a string with a regular expression, and returns an iterable of matches
* containing the results of that search.
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
*/
matchAll(regexp: RegExp): IterableIterator<RegExpMatchArray>;
/**
* Matches a string with a regular expression, and returns an iterable of matches
* containing the results of that search.
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
*/
matchAll(regexp: RegExp): IterableIterator<RegExpMatchArray>;
}
22 changes: 11 additions & 11 deletions lib/lib.es2020.symbol.wellknown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ and limitations under the License.
/// <reference lib="es2015.symbol" />

interface SymbolConstructor {
/**
* A regular expression method that matches the regular expression against a string. Called
* by the String.prototype.matchAll method.
*/
readonly matchAll: symbol;
/**
* A regular expression method that matches the regular expression against a string. Called
* by the String.prototype.matchAll method.
*/
readonly matchAll: symbol;
}

interface RegExp {
/**
* Matches a string with this regular expression, and returns an iterable of matches
* containing the results of that search.
* @param string A string to search within.
*/
[Symbol.matchAll](str: string): IterableIterator<RegExpMatchArray>;
/**
* Matches a string with this regular expression, and returns an iterable of matches
* containing the results of that search.
* @param string A string to search within.
*/
[Symbol.matchAll](str: string): IterableIterator<RegExpMatchArray>;
}
Loading