mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint
This commit is contained in:
@@ -429,8 +429,8 @@ namespace ts.BuilderState {
|
||||
const references = state.referencedMap.get(path);
|
||||
if (references) {
|
||||
const iterator = references.keys();
|
||||
for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) {
|
||||
queue.push(value as Path);
|
||||
for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
|
||||
queue.push(iterResult.value as Path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+940
-412
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,7 @@ namespace ts {
|
||||
["es2017.string", "lib.es2017.string.d.ts"],
|
||||
["es2017.intl", "lib.es2017.intl.d.ts"],
|
||||
["es2017.typedarrays", "lib.es2017.typedarrays.d.ts"],
|
||||
["es2018.asyncgenerator", "lib.es2018.asyncgenerator.d.ts"],
|
||||
["es2018.asynciterable", "lib.es2018.asynciterable.d.ts"],
|
||||
["es2018.intl", "lib.es2018.intl.d.ts"],
|
||||
["es2018.promise", "lib.es2018.promise.d.ts"],
|
||||
@@ -1899,7 +1900,9 @@ namespace ts {
|
||||
case "object":
|
||||
return {};
|
||||
default:
|
||||
return option.type.keys().next().value;
|
||||
const iterResult = option.type.keys().next();
|
||||
if (!iterResult.done) return iterResult.value;
|
||||
return Debug.fail("Expected 'option.type' to have entries.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-14
@@ -25,7 +25,6 @@ namespace ts {
|
||||
" __sortedArrayBrand": any;
|
||||
}
|
||||
|
||||
|
||||
/** ES6 Map interface, only read methods included. */
|
||||
export interface ReadonlyMap<T> {
|
||||
get(key: string): T | undefined;
|
||||
@@ -46,7 +45,7 @@ namespace ts {
|
||||
|
||||
/** ES6 Iterator type. */
|
||||
export interface Iterator<T> {
|
||||
next(): { value: T, done: false } | { value: never, done: true };
|
||||
next(): { value: T, done?: false } | { value: never, done: true };
|
||||
}
|
||||
|
||||
/** Array that is only intended to be pushed to, never read. */
|
||||
@@ -299,12 +298,13 @@ namespace ts {
|
||||
forEach(action: (value: T, key: string) => void): void {
|
||||
const iterator = this.entries();
|
||||
while (true) {
|
||||
const { value: entry, done } = iterator.next();
|
||||
if (done) {
|
||||
const iterResult = iterator.next();
|
||||
if (iterResult.done) {
|
||||
break;
|
||||
}
|
||||
|
||||
action(entry[1], entry[0]);
|
||||
const [key, value] = iterResult.value;
|
||||
action(value, key);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -348,11 +348,11 @@ namespace ts {
|
||||
|
||||
export function firstDefinedIterator<T, U>(iter: Iterator<T>, callback: (element: T) => U | undefined): U | undefined {
|
||||
while (true) {
|
||||
const { value, done } = iter.next();
|
||||
if (done) {
|
||||
const iterResult = iter.next();
|
||||
if (iterResult.done) {
|
||||
return undefined;
|
||||
}
|
||||
const result = callback(value);
|
||||
const result = callback(iterResult.value);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
@@ -377,7 +377,7 @@ namespace ts {
|
||||
return { value: undefined as never, done: true };
|
||||
}
|
||||
i++;
|
||||
return { value: [arrayA[i - 1], arrayB[i - 1]], done: false };
|
||||
return { value: [arrayA[i - 1], arrayB[i - 1]] as [T, U], done: false };
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -569,7 +569,7 @@ namespace ts {
|
||||
return {
|
||||
next() {
|
||||
const iterRes = iter.next();
|
||||
return iterRes.done ? iterRes : { value: mapFn(iterRes.value), done: false };
|
||||
return iterRes.done ? iterRes as { done: true, value: never } : { value: mapFn(iterRes.value), done: false };
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -680,7 +680,7 @@ namespace ts {
|
||||
}
|
||||
const iterRes = iter.next();
|
||||
if (iterRes.done) {
|
||||
return iterRes;
|
||||
return iterRes as { done: true, value: never };
|
||||
}
|
||||
currentIter = getIterator(iterRes.value);
|
||||
}
|
||||
@@ -755,7 +755,7 @@ namespace ts {
|
||||
while (true) {
|
||||
const res = iter.next();
|
||||
if (res.done) {
|
||||
return res;
|
||||
return res as { done: true, value: never };
|
||||
}
|
||||
const value = mapFn(res.value);
|
||||
if (value !== undefined) {
|
||||
@@ -1081,6 +1081,7 @@ namespace ts {
|
||||
* @param value The value to append to the array. If `value` is `undefined`, nothing is
|
||||
* appended.
|
||||
*/
|
||||
export function append<TArray extends any[] | undefined, TValue extends NonNullable<TArray>[number] | undefined>(to: TArray, value: TValue): [undefined, undefined] extends [TArray, TValue] ? TArray : NonNullable<TArray>[number][];
|
||||
export function append<T>(to: T[], value: T | undefined): T[];
|
||||
export function append<T>(to: T[] | undefined, value: T): T[];
|
||||
export function append<T>(to: T[] | undefined, value: T | undefined): T[] | undefined;
|
||||
@@ -1405,8 +1406,8 @@ namespace ts {
|
||||
export function arrayFrom<T>(iterator: Iterator<T> | IterableIterator<T>): T[];
|
||||
export function arrayFrom<T, U>(iterator: Iterator<T> | IterableIterator<T>, map?: (t: T) => U): (T | U)[] {
|
||||
const result: (T | U)[] = [];
|
||||
for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) {
|
||||
result.push(map ? map(value) : value);
|
||||
for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
|
||||
result.push(map ? map(iterResult.value) : iterResult.value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1764,7 +1764,7 @@
|
||||
"category": "Error",
|
||||
"code": 2489
|
||||
},
|
||||
"The type returned by the 'next()' method of an iterator must have a 'value' property.": {
|
||||
"The type returned by the '{0}()' method of an iterator must have a 'value' property.": {
|
||||
"category": "Error",
|
||||
"code": 2490
|
||||
},
|
||||
@@ -1992,7 +1992,7 @@
|
||||
"category": "Error",
|
||||
"code": 2546
|
||||
},
|
||||
"The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property.": {
|
||||
"The type returned by the '{0}()' method of an async iterator must be a promise for a type with a 'value' property.": {
|
||||
"category": "Error",
|
||||
"code": 2547
|
||||
},
|
||||
@@ -2653,6 +2653,30 @@
|
||||
"category": "Error",
|
||||
"code": 2762
|
||||
},
|
||||
"Cannot iterate value because the 'next' method of its iterator expects type '{1}', but for-of will always send '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2763
|
||||
},
|
||||
"Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array spread will always send '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2764
|
||||
},
|
||||
"Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array destructuring will always send '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2765
|
||||
},
|
||||
"Cannot delegate iteration to value because the 'next' method of its iterator expects type '{1}', but the containing generator will always send '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2766
|
||||
},
|
||||
"The '{0}' property of an iterator must be a method.": {
|
||||
"category": "Error",
|
||||
"code": 2767
|
||||
},
|
||||
"The '{0}' property of an async iterator must be a method.": {
|
||||
"category": "Error",
|
||||
"code": 2768
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
@@ -4214,7 +4238,7 @@
|
||||
"category": "Error",
|
||||
"code": 7024
|
||||
},
|
||||
"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type.": {
|
||||
"Generator implicitly has yield type '{0}' because it does not yield any values. Consider supplying a return type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 7025
|
||||
},
|
||||
@@ -4336,6 +4360,11 @@
|
||||
"category": "Error",
|
||||
"code": 7054
|
||||
},
|
||||
"'{0}', which lacks return-type annotation, implicitly has an '{1}' yield type.": {
|
||||
"category": "Error",
|
||||
"code": 7055
|
||||
},
|
||||
|
||||
"You cannot rename this element.": {
|
||||
"category": "Error",
|
||||
"code": 8000
|
||||
|
||||
@@ -466,6 +466,8 @@ namespace ts {
|
||||
visitNode(cbNode, (<JSDocPropertyLikeTag>node).typeExpression)
|
||||
: visitNode(cbNode, (<JSDocPropertyLikeTag>node).typeExpression) ||
|
||||
visitNode(cbNode, (<JSDocPropertyLikeTag>node).name));
|
||||
case SyntaxKind.JSDocAuthorTag:
|
||||
return visitNode(cbNode, (node as JSDocTag).tagName);
|
||||
case SyntaxKind.JSDocAugmentsTag:
|
||||
return visitNode(cbNode, (node as JSDocTag).tagName) ||
|
||||
visitNode(cbNode, (<JSDocAugmentsTag>node).class);
|
||||
@@ -6616,6 +6618,9 @@ namespace ts {
|
||||
|
||||
let tag: JSDocTag | undefined;
|
||||
switch (tagName.escapedText) {
|
||||
case "author":
|
||||
tag = parseAuthorTag(start, tagName, margin);
|
||||
break;
|
||||
case "augments":
|
||||
case "extends":
|
||||
tag = parseAugmentsTag(start, tagName);
|
||||
@@ -6895,6 +6900,69 @@ namespace ts {
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function parseAuthorTag(start: number, tagName: Identifier, indent: number): JSDocAuthorTag {
|
||||
const result = <JSDocAuthorTag>createNode(SyntaxKind.JSDocAuthorTag, start);
|
||||
result.tagName = tagName;
|
||||
|
||||
const authorInfoWithEmail = tryParse(() => tryParseAuthorNameAndEmail());
|
||||
if (!authorInfoWithEmail) {
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
result.comment = authorInfoWithEmail;
|
||||
|
||||
if (lookAhead(() => nextToken() !== SyntaxKind.NewLineTrivia)) {
|
||||
const comment = parseTagComments(indent);
|
||||
if (comment) {
|
||||
result.comment += comment;
|
||||
}
|
||||
}
|
||||
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function tryParseAuthorNameAndEmail(): string | undefined {
|
||||
const comments: string[] = [];
|
||||
let seenLessThan = false;
|
||||
let seenGreaterThan = false;
|
||||
let token = scanner.getToken();
|
||||
|
||||
loop: while (true) {
|
||||
switch (token) {
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.WhitespaceTrivia:
|
||||
case SyntaxKind.DotToken:
|
||||
case SyntaxKind.AtToken:
|
||||
comments.push(scanner.getTokenText());
|
||||
break;
|
||||
case SyntaxKind.LessThanToken:
|
||||
if (seenLessThan || seenGreaterThan) {
|
||||
return;
|
||||
}
|
||||
seenLessThan = true;
|
||||
comments.push(scanner.getTokenText());
|
||||
break;
|
||||
case SyntaxKind.GreaterThanToken:
|
||||
if (!seenLessThan || seenGreaterThan) {
|
||||
return;
|
||||
}
|
||||
seenGreaterThan = true;
|
||||
comments.push(scanner.getTokenText());
|
||||
scanner.setTextPos(scanner.getTokenPos() + 1);
|
||||
break loop;
|
||||
case SyntaxKind.NewLineTrivia:
|
||||
case SyntaxKind.EndOfFileToken:
|
||||
break loop;
|
||||
}
|
||||
|
||||
token = nextTokenJSDoc();
|
||||
}
|
||||
|
||||
if (seenLessThan && seenGreaterThan) {
|
||||
return comments.length === 0 ? undefined : comments.join("");
|
||||
}
|
||||
}
|
||||
|
||||
function parseAugmentsTag(start: number, tagName: Identifier): JSDocAugmentsTag {
|
||||
const result = <JSDocAugmentsTag>createNode(SyntaxKind.JSDocAugmentsTag, start);
|
||||
result.tagName = tagName;
|
||||
|
||||
@@ -2087,6 +2087,8 @@ namespace ts {
|
||||
return token = SyntaxKind.CloseBracketToken;
|
||||
case CharacterCodes.lessThan:
|
||||
return token = SyntaxKind.LessThanToken;
|
||||
case CharacterCodes.greaterThan:
|
||||
return token = SyntaxKind.GreaterThanToken;
|
||||
case CharacterCodes.equals:
|
||||
return token = SyntaxKind.EqualsToken;
|
||||
case CharacterCodes.comma:
|
||||
|
||||
@@ -148,7 +148,8 @@ namespace ts {
|
||||
const sourceIndexToNewSourceIndexMap: number[] = [];
|
||||
let nameIndexToNewNameIndexMap: number[] | undefined;
|
||||
const mappingIterator = decodeMappings(map.mappings);
|
||||
for (let { value: raw, done } = mappingIterator.next(); !done; { value: raw, done } = mappingIterator.next()) {
|
||||
for (let iterResult = mappingIterator.next(); !iterResult.done; iterResult = mappingIterator.next()) {
|
||||
const raw = iterResult.value;
|
||||
if (end && (
|
||||
raw.generatedLine > end.line ||
|
||||
(raw.generatedLine === end.line && raw.generatedCharacter > end.character))) {
|
||||
|
||||
+20
-4
@@ -17,6 +17,7 @@ namespace ts {
|
||||
| SyntaxKind.OpenBraceToken
|
||||
| SyntaxKind.CloseBraceToken
|
||||
| SyntaxKind.LessThanToken
|
||||
| SyntaxKind.GreaterThanToken
|
||||
| SyntaxKind.OpenBracketToken
|
||||
| SyntaxKind.CloseBracketToken
|
||||
| SyntaxKind.EqualsToken
|
||||
@@ -459,6 +460,7 @@ namespace ts {
|
||||
JSDocSignature,
|
||||
JSDocTag,
|
||||
JSDocAugmentsTag,
|
||||
JSDocAuthorTag,
|
||||
JSDocClassTag,
|
||||
JSDocCallbackTag,
|
||||
JSDocEnumTag,
|
||||
@@ -2456,6 +2458,10 @@ namespace ts {
|
||||
class: ExpressionWithTypeArguments & { expression: Identifier | PropertyAccessEntityNameExpression };
|
||||
}
|
||||
|
||||
export interface JSDocAuthorTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocAuthorTag;
|
||||
}
|
||||
|
||||
export interface JSDocClassTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocClassTag;
|
||||
}
|
||||
@@ -4289,13 +4295,23 @@ namespace ts {
|
||||
regularType: ResolvedType; // Regular version of fresh type
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface IterationTypes {
|
||||
readonly yieldType: Type;
|
||||
readonly returnType: Type;
|
||||
readonly nextType: Type;
|
||||
}
|
||||
|
||||
// Just a place to cache element types of iterables and iterators
|
||||
/* @internal */
|
||||
export interface IterableOrIteratorType extends ObjectType, UnionType {
|
||||
iteratedTypeOfIterable?: Type;
|
||||
iteratedTypeOfIterator?: Type;
|
||||
iteratedTypeOfAsyncIterable?: Type;
|
||||
iteratedTypeOfAsyncIterator?: Type;
|
||||
iterationTypesOfGeneratorReturnType?: IterationTypes;
|
||||
iterationTypesOfAsyncGeneratorReturnType?: IterationTypes;
|
||||
iterationTypesOfIterable?: IterationTypes;
|
||||
iterationTypesOfIterator?: IterationTypes;
|
||||
iterationTypesOfAsyncIterable?: IterationTypes;
|
||||
iterationTypesOfAsyncIterator?: IterationTypes;
|
||||
iterationTypesOfIteratorResult?: IterationTypes;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
@@ -151,8 +151,8 @@ namespace ts {
|
||||
export function forEachEntry<T, U>(map: ReadonlyMap<T>, callback: (value: T, key: string) => U | undefined): U | undefined;
|
||||
export function forEachEntry<T, U>(map: ReadonlyUnderscoreEscapedMap<T> | ReadonlyMap<T>, callback: (value: T, key: (string & __String)) => U | undefined): U | undefined {
|
||||
const iterator = map.entries();
|
||||
for (let { value: pair, done } = iterator.next(); !done; { value: pair, done } = iterator.next()) {
|
||||
const [key, value] = pair;
|
||||
for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
|
||||
const [key, value] = iterResult.value;
|
||||
const result = callback(value, key as (string & __String));
|
||||
if (result) {
|
||||
return result;
|
||||
@@ -166,8 +166,8 @@ namespace ts {
|
||||
export function forEachKey<T>(map: ReadonlyMap<{}>, callback: (key: string) => T | undefined): T | undefined;
|
||||
export function forEachKey<T>(map: ReadonlyUnderscoreEscapedMap<{}> | ReadonlyMap<{}>, callback: (key: string & __String) => T | undefined): T | undefined {
|
||||
const iterator = map.keys();
|
||||
for (let { value: key, done } = iterator.next(); !done; { value: key, done } = iterator.next()) {
|
||||
const result = callback(key as string & __String);
|
||||
for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
|
||||
const result = callback(iterResult.value as string & __String);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
@@ -6078,6 +6078,10 @@ namespace ts {
|
||||
return node.kind === SyntaxKind.JSDocComment;
|
||||
}
|
||||
|
||||
export function isJSDocAuthorTag(node: Node): node is JSDocAuthorTag {
|
||||
return node.kind === SyntaxKind.JSDocAuthorTag;
|
||||
}
|
||||
|
||||
export function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag {
|
||||
return node.kind === SyntaxKind.JSDocAugmentsTag;
|
||||
}
|
||||
|
||||
@@ -301,7 +301,8 @@ namespace Harness.SourceMapRecorder {
|
||||
|
||||
SourceMapSpanWriter.initializeSourceMapSpanWriter(sourceMapRecorder, sourceMapData.sourceMap, currentFile);
|
||||
const mapper = ts.decodeMappings(sourceMapData.sourceMap.mappings);
|
||||
for (let { value: decodedSourceMapping, done } = mapper.next(); !done; { value: decodedSourceMapping, done } = mapper.next()) {
|
||||
for (let iterResult = mapper.next(); !iterResult.done; iterResult = mapper.next()) {
|
||||
const decodedSourceMapping = iterResult.value;
|
||||
const currentSourceFile = ts.isSourceMapping(decodedSourceMapping)
|
||||
? program.getSourceFile(sourceMapData.inputSourceFileNames[decodedSourceMapping.sourceIndex])
|
||||
: undefined;
|
||||
@@ -335,7 +336,8 @@ namespace Harness.SourceMapRecorder {
|
||||
|
||||
SourceMapSpanWriter.initializeSourceMapSpanWriter(sourceMapRecorder, sourceMap, currentFile);
|
||||
const mapper = ts.decodeMappings(sourceMap.mappings);
|
||||
for (let { value: decodedSourceMapping, done } = mapper.next(); !done; { value: decodedSourceMapping, done } = mapper.next()) {
|
||||
for (let iterResult = mapper.next(); !iterResult.done; iterResult = mapper.next()) {
|
||||
const decodedSourceMapping = iterResult.value;
|
||||
const currentSourceFile = ts.isSourceMapping(decodedSourceMapping)
|
||||
? getFile(sourceFileAbsolutePaths[decodedSourceMapping.sourceIndex])
|
||||
: undefined;
|
||||
|
||||
+2
-2
@@ -682,7 +682,7 @@ namespace vfs {
|
||||
|
||||
if (isDirectory(node)) throw createIOError("EISDIR");
|
||||
if (!isFile(node)) throw createIOError("EBADF");
|
||||
node.buffer = Buffer.isBuffer(data) ? data.slice() : ts.sys.bufferFrom!("" + data, encoding || "utf8");
|
||||
node.buffer = Buffer.isBuffer(data) ? data.slice() : ts.sys.bufferFrom!("" + data, encoding || "utf8") as Buffer;
|
||||
node.size = node.buffer.byteLength;
|
||||
node.mtimeMs = time;
|
||||
node.ctimeMs = time;
|
||||
@@ -1203,7 +1203,7 @@ namespace vfs {
|
||||
}
|
||||
},
|
||||
readFileSync(path: string): Buffer {
|
||||
return ts.sys.bufferFrom!(host.readFile(path)!, "utf8"); // TODO: GH#18217
|
||||
return ts.sys.bufferFrom!(host.readFile(path)!, "utf8") as Buffer; // TODO: GH#18217
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Vendored
+9
-1
@@ -1,4 +1,12 @@
|
||||
interface Generator extends Iterator<any> { }
|
||||
/// <reference lib="es2015.iterable" />
|
||||
|
||||
interface Generator<T = unknown, TReturn = any, TNext = unknown> extends Iterator<T, TReturn, TNext> {
|
||||
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
||||
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
||||
return(value: TReturn): IteratorResult<T, TReturn>;
|
||||
throw(e: any): IteratorResult<T, TReturn>;
|
||||
[Symbol.iterator](): Generator<T, TReturn, TNext>;
|
||||
}
|
||||
|
||||
interface GeneratorFunction {
|
||||
/**
|
||||
|
||||
Vendored
+15
-7
@@ -8,15 +8,23 @@ interface SymbolConstructor {
|
||||
readonly iterator: symbol;
|
||||
}
|
||||
|
||||
interface IteratorResult<T> {
|
||||
done: boolean;
|
||||
value: T;
|
||||
interface IteratorYieldResult<TYield> {
|
||||
done?: false;
|
||||
value: TYield;
|
||||
}
|
||||
|
||||
interface Iterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
return?(value?: any): IteratorResult<T>;
|
||||
throw?(e?: any): IteratorResult<T>;
|
||||
interface IteratorReturnResult<TReturn> {
|
||||
done: true;
|
||||
value: TReturn;
|
||||
}
|
||||
|
||||
type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
|
||||
|
||||
interface Iterator<T, TReturn = any, TNext = undefined> {
|
||||
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
||||
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
||||
return?(value?: TReturn): IteratorResult<T, TReturn>;
|
||||
throw?(e?: any): IteratorResult<T, TReturn>;
|
||||
}
|
||||
|
||||
interface Iterable<T> {
|
||||
|
||||
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
/// <reference lib="es2018.asynciterable" />
|
||||
|
||||
interface AsyncGenerator<T = unknown, TReturn = any, TNext = unknown> extends AsyncIterator<T, TReturn, TNext> {
|
||||
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
||||
next(...args: [] | [TNext | PromiseLike<TNext>]): Promise<IteratorResult<T, TReturn>>;
|
||||
return(value: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
|
||||
throw(e: any): Promise<IteratorResult<T, TReturn>>;
|
||||
[Symbol.asyncIterator](): AsyncGenerator<T, TReturn, TNext>;
|
||||
}
|
||||
|
||||
interface AsyncGeneratorFunction {
|
||||
/**
|
||||
* Creates a new AsyncGenerator object.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
new (...args: any[]): AsyncGenerator;
|
||||
/**
|
||||
* Creates a new AsyncGenerator object.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
(...args: any[]): AsyncGenerator;
|
||||
/**
|
||||
* The length of the arguments.
|
||||
*/
|
||||
readonly length: number;
|
||||
/**
|
||||
* Returns the name of the function.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: AsyncGenerator;
|
||||
}
|
||||
|
||||
interface AsyncGeneratorFunctionConstructor {
|
||||
/**
|
||||
* Creates a new AsyncGenerator function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
new (...args: string[]): AsyncGeneratorFunction;
|
||||
/**
|
||||
* Creates a new AsyncGenerator function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
(...args: string[]): AsyncGeneratorFunction;
|
||||
/**
|
||||
* The length of the arguments.
|
||||
*/
|
||||
readonly length: number;
|
||||
/**
|
||||
* Returns the name of the function.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: AsyncGeneratorFunction;
|
||||
}
|
||||
Vendored
+5
-4
@@ -9,10 +9,11 @@ interface SymbolConstructor {
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
|
||||
interface AsyncIterator<T> {
|
||||
next(value?: any): Promise<IteratorResult<T>>;
|
||||
return?(value?: any): Promise<IteratorResult<T>>;
|
||||
throw?(e?: any): Promise<IteratorResult<T>>;
|
||||
interface AsyncIterator<T, TReturn = any, TNext = undefined> {
|
||||
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
||||
next(...args: [] | [TNext | PromiseLike<TNext>]): Promise<IteratorResult<T, TReturn>>;
|
||||
return?(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
|
||||
throw?(e?: any): Promise<IteratorResult<T, TReturn>>;
|
||||
}
|
||||
|
||||
interface AsyncIterable<T> {
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
/// <reference lib="es2017" />
|
||||
/// <reference lib="es2018.asyncgenerator" />
|
||||
/// <reference lib="es2018.asynciterable" />
|
||||
/// <reference lib="es2018.promise" />
|
||||
/// <reference lib="es2018.regexp" />
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
"es2017.string",
|
||||
"es2017.intl",
|
||||
"es2017.typedarrays",
|
||||
"es2018.asyncgenerator",
|
||||
"es2018.asynciterable",
|
||||
"es2018.regexp",
|
||||
"es2018.promise",
|
||||
|
||||
@@ -2831,8 +2831,9 @@ namespace ts.server {
|
||||
let assignOrphanScriptInfosToInferredProject = false;
|
||||
if (openFiles) {
|
||||
while (true) {
|
||||
const { value: file, done } = openFiles.next();
|
||||
if (done) break;
|
||||
const iterResult = openFiles.next();
|
||||
if (iterResult.done) break;
|
||||
const file = iterResult.value;
|
||||
const scriptInfo = this.getScriptInfo(file.fileName);
|
||||
Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen(), "Script should not exist and not be open already");
|
||||
// Create script infos so we have the new content for all the open files before we do any updates to projects
|
||||
@@ -2849,8 +2850,9 @@ namespace ts.server {
|
||||
|
||||
if (changedFiles) {
|
||||
while (true) {
|
||||
const { value: file, done } = changedFiles.next();
|
||||
if (done) break;
|
||||
const iterResult = changedFiles.next();
|
||||
if (iterResult.done) break;
|
||||
const file = iterResult.value;
|
||||
const scriptInfo = this.getScriptInfo(file.fileName)!;
|
||||
Debug.assert(!!scriptInfo);
|
||||
// Make edits to script infos and marks containing project as dirty
|
||||
@@ -2886,8 +2888,9 @@ namespace ts.server {
|
||||
/* @internal */
|
||||
applyChangesToFile(scriptInfo: ScriptInfo, changes: Iterator<TextChange>) {
|
||||
while (true) {
|
||||
const { value: change, done } = changes.next();
|
||||
if (done) break;
|
||||
const iterResult = changes.next();
|
||||
if (iterResult.done) break;
|
||||
const change = iterResult.value;
|
||||
scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,8 +291,8 @@ namespace Harness.Parallel.Host {
|
||||
worker.accumulatedOutput += d.toString();
|
||||
console.log(`[Worker ${i}]`, d.toString());
|
||||
};
|
||||
worker.process.stderr.on("data", appendOutput);
|
||||
worker.process.stdout.on("data", appendOutput);
|
||||
worker.process.stderr!.on("data", appendOutput);
|
||||
worker.process.stdout!.on("data", appendOutput);
|
||||
const killChild = (timeout: TaskTimeout) => {
|
||||
worker.process.kill();
|
||||
console.error(`Worker exceeded ${timeout.duration}ms timeout ${worker.currentTasks && worker.currentTasks.length ? `while running test '${worker.currentTasks[0].file}'.` : `during test setup.`}`);
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5,invalidOption", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
file: undefined,
|
||||
@@ -259,7 +259,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5,", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
file: undefined,
|
||||
@@ -278,7 +278,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5, ", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
file: undefined,
|
||||
|
||||
@@ -133,7 +133,9 @@ namespace ts {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
const val = option.type.keys().next().value;
|
||||
const iterResult = option.type.keys().next();
|
||||
if (iterResult.done) return Debug.fail("Expected 'option.type' to have entries");
|
||||
const val = iterResult.value;
|
||||
if (option.isTSConfigOnly) {
|
||||
args = ["-p", "tsconfig.json"];
|
||||
configObject = { compilerOptions: { [option.name]: val } };
|
||||
|
||||
@@ -315,6 +315,11 @@ namespace ts {
|
||||
* {@link first link}
|
||||
* Inside {@link link text} thing
|
||||
* @see {@link second link text} and {@link Foo|a foo} as well.
|
||||
*/`);
|
||||
parsesCorrectly("authorTag",
|
||||
`/**
|
||||
* @author John Doe <john.doe@example.com>
|
||||
* @author John Doe <john.doe@example.com> unexpected comment
|
||||
*/`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -68,12 +68,13 @@ namespace ts {
|
||||
// Use an iterator.
|
||||
const iterator = map.entries();
|
||||
while (true) {
|
||||
const { value: tuple, done } = iterator.next();
|
||||
if (done) {
|
||||
const iterResult = iterator.next();
|
||||
if (iterResult.done) {
|
||||
break;
|
||||
}
|
||||
|
||||
doForEach(tuple[1], tuple[0]);
|
||||
const [key, value] = iterResult.value;
|
||||
doForEach(value, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -438,10 +438,13 @@ namespace ts.projectSystem {
|
||||
export function configuredProjectAt(projectService: server.ProjectService, index: number) {
|
||||
const values = projectService.configuredProjects.values();
|
||||
while (index > 0) {
|
||||
values.next();
|
||||
const iterResult = values.next();
|
||||
if (iterResult.done) return Debug.fail("Expected a result.");
|
||||
index--;
|
||||
}
|
||||
return values.next().value;
|
||||
const iterResult = values.next();
|
||||
if (iterResult.done) return Debug.fail("Expected a result.");
|
||||
return iterResult.value;
|
||||
}
|
||||
|
||||
export function checkProjectActualFiles(project: server.Project, expectedFiles: ReadonlyArray<string>) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"pretty": true,
|
||||
"lib": ["es2015.iterable", "es5"],
|
||||
"lib": ["es2015.iterable", "es2015.generator", "es5"],
|
||||
"target": "es5",
|
||||
"rootDir": ".",
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts ===
|
||||
function * yield() {
|
||||
>yield : () => IterableIterator<any>
|
||||
>yield : () => Generator<never, void, unknown>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts ===
|
||||
function * foo() {
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v: yield;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts ===
|
||||
function * foo() {
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts ===
|
||||
function*foo(a = yield) {
|
||||
>foo : (a?: any) => IterableIterator<any>
|
||||
>foo : (a?: any) => Generator<never, void, unknown>
|
||||
>a : any
|
||||
>yield : any
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts ===
|
||||
function*bar() {
|
||||
>bar : () => IterableIterator<any>
|
||||
>bar : () => Generator<never, void, unknown>
|
||||
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function*foo(a = yield) {
|
||||
>foo : (a?: any) => IterableIterator<any>
|
||||
>foo : (a?: any) => Generator<never, void, unknown>
|
||||
>a : any
|
||||
>yield : any
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts ===
|
||||
function * foo() {
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<any, void, unknown>
|
||||
|
||||
var v = { [yield]: foo }
|
||||
>v : { [x: number]: () => IterableIterator<any>; }
|
||||
>{ [yield]: foo } : { [x: number]: () => IterableIterator<any>; }
|
||||
>[yield] : () => IterableIterator<any>
|
||||
>v : { [x: number]: () => Generator<any, void, unknown>; }
|
||||
>{ [yield]: foo } : { [x: number]: () => Generator<any, void, unknown>; }
|
||||
>[yield] : () => Generator<any, void, unknown>
|
||||
>yield : any
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<any, void, unknown>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts ===
|
||||
var v = function * () { }
|
||||
>v : () => IterableIterator<any>
|
||||
>function * () { } : () => IterableIterator<any>
|
||||
>v : () => Generator<never, void, unknown>
|
||||
>function * () { } : () => Generator<never, void, unknown>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts ===
|
||||
var v = function * foo() { }
|
||||
>v : () => IterableIterator<any>
|
||||
>function * foo() { } : () => IterableIterator<any>
|
||||
>foo : () => IterableIterator<any>
|
||||
>v : () => Generator<never, void, unknown>
|
||||
>function * foo() { } : () => Generator<never, void, unknown>
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts ===
|
||||
var v = { *foo() { } }
|
||||
>v : { foo(): IterableIterator<any>; }
|
||||
>{ *foo() { } } : { foo(): IterableIterator<any>; }
|
||||
>foo : () => IterableIterator<any>
|
||||
>v : { foo(): Generator<never, void, unknown>; }
|
||||
>{ *foo() { } } : { foo(): Generator<never, void, unknown>; }
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2_es6.ts ===
|
||||
var v = { *() { } }
|
||||
>v : { (Missing)(): IterableIterator<any>; }
|
||||
>{ *() { } } : { (Missing)(): IterableIterator<any>; }
|
||||
> : () => IterableIterator<any>
|
||||
>v : { (Missing)(): Generator<never, void, unknown>; }
|
||||
>{ *() { } } : { (Missing)(): Generator<never, void, unknown>; }
|
||||
> : () => Generator<never, void, unknown>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3_es6.ts ===
|
||||
var v = { *{ } }
|
||||
>v : { (Missing)(): IterableIterator<any>; }
|
||||
>{ *{ } } : { (Missing)(): IterableIterator<any>; }
|
||||
> : () => IterableIterator<any>
|
||||
>v : { (Missing)(): Generator<never, void, unknown>; }
|
||||
>{ *{ } } : { (Missing)(): Generator<never, void, unknown>; }
|
||||
> : () => Generator<never, void, unknown>
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts ===
|
||||
var v = { *[foo()]() { } }
|
||||
>v : { [x: number]: () => IterableIterator<any>; }
|
||||
>{ *[foo()]() { } } : { [x: number]: () => IterableIterator<any>; }
|
||||
>[foo()] : () => IterableIterator<any>
|
||||
>v : { [x: number]: () => Generator<never, void, unknown>; }
|
||||
>{ *[foo()]() { } } : { [x: number]: () => Generator<never, void, unknown>; }
|
||||
>[foo()] : () => Generator<never, void, unknown>
|
||||
>foo() : any
|
||||
>foo : any
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6_es6.ts ===
|
||||
var v = { *<T>() { } }
|
||||
>v : { (Missing)<T>(): IterableIterator<any>; }
|
||||
>{ *<T>() { } } : { (Missing)<T>(): IterableIterator<any>; }
|
||||
> : <T>() => IterableIterator<any>
|
||||
>v : { (Missing)<T>(): Generator<never, void, unknown>; }
|
||||
>{ *<T>() { } } : { (Missing)<T>(): Generator<never, void, unknown>; }
|
||||
> : <T>() => Generator<never, void, unknown>
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"kind": "JSDocComment",
|
||||
"pos": 0,
|
||||
"end": 112,
|
||||
"modifierFlagsCache": 0,
|
||||
"transformFlags": 0,
|
||||
"tags": {
|
||||
"0": {
|
||||
"kind": "JSDocAuthorTag",
|
||||
"pos": 7,
|
||||
"end": 50,
|
||||
"modifierFlagsCache": 0,
|
||||
"transformFlags": 0,
|
||||
"tagName": {
|
||||
"kind": "Identifier",
|
||||
"pos": 8,
|
||||
"end": 14,
|
||||
"modifierFlagsCache": 0,
|
||||
"transformFlags": 0,
|
||||
"escapedText": "author"
|
||||
},
|
||||
"comment": "John Doe <john.doe@example.com>"
|
||||
},
|
||||
"1": {
|
||||
"kind": "JSDocAuthorTag",
|
||||
"pos": 50,
|
||||
"end": 110,
|
||||
"modifierFlagsCache": 0,
|
||||
"transformFlags": 0,
|
||||
"tagName": {
|
||||
"kind": "Identifier",
|
||||
"pos": 51,
|
||||
"end": 57,
|
||||
"modifierFlagsCache": 0,
|
||||
"transformFlags": 0,
|
||||
"escapedText": "author"
|
||||
},
|
||||
"comment": "John Doe <john.doe@example.com> unexpected comment"
|
||||
},
|
||||
"length": 2,
|
||||
"pos": 7,
|
||||
"end": 110
|
||||
}
|
||||
}
|
||||
@@ -3,5 +3,5 @@ class C {
|
||||
>C : C
|
||||
|
||||
*foo() { }
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ class C {
|
||||
>C : C
|
||||
|
||||
public * foo() { }
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
*[foo]() { }
|
||||
>[foo] : () => IterableIterator<any>
|
||||
>[foo] : () => Generator<never, void, unknown>
|
||||
>foo : any
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ class C {
|
||||
>C : C
|
||||
|
||||
*() { }
|
||||
> : () => IterableIterator<any>
|
||||
> : () => Generator<never, void, unknown>
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ class C {
|
||||
>C : C
|
||||
|
||||
*foo<T>() { }
|
||||
>foo : <T>() => IterableIterator<any>
|
||||
>foo : <T>() => Generator<never, void, unknown>
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts ===
|
||||
var v = { * foo() {
|
||||
>v : { foo(): IterableIterator<any>; }
|
||||
>{ * foo() { yield(foo); }} : { foo(): IterableIterator<any>; }
|
||||
>foo : () => IterableIterator<any>
|
||||
>v : { foo(): Generator<any, void, unknown>; }
|
||||
>{ * foo() { yield(foo); }} : { foo(): Generator<any, void, unknown>; }
|
||||
>foo : () => Generator<any, void, unknown>
|
||||
|
||||
yield(foo);
|
||||
>yield(foo) : any
|
||||
|
||||
@@ -3,7 +3,7 @@ class C {
|
||||
>C : C
|
||||
|
||||
*foo() {
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<any, void, unknown>
|
||||
|
||||
yield(foo);
|
||||
>yield(foo) : any
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts ===
|
||||
function* foo() { yield }
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<any, void, unknown>
|
||||
>yield : any
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
|
||||
function bar() {
|
||||
>bar : () => void
|
||||
|
||||
yield foo;
|
||||
>yield foo : any
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts ===
|
||||
function*foo() {
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
|
||||
function bar() {
|
||||
>bar : () => void
|
||||
|
||||
function* quux() {
|
||||
>quux : () => IterableIterator<() => IterableIterator<any>>
|
||||
>quux : () => Generator<() => Generator<never, void, unknown>, void, unknown>
|
||||
|
||||
yield(foo);
|
||||
>yield(foo) : any
|
||||
>(foo) : () => IterableIterator<any>
|
||||
>foo : () => IterableIterator<any>
|
||||
>(foo) : () => Generator<never, void, unknown>
|
||||
>foo : () => Generator<never, void, unknown>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<any, void, unknown>
|
||||
|
||||
yield
|
||||
>yield : any
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<any, void, unknown>
|
||||
|
||||
yield;
|
||||
>yield : any
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression5_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => IterableIterator<any>
|
||||
>foo : () => Generator<any, void, any>
|
||||
|
||||
yield*
|
||||
>yield* : any
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => IterableIterator<typeof foo>
|
||||
>foo : () => Generator<typeof foo, void, unknown>
|
||||
|
||||
yield foo
|
||||
>yield foo : any
|
||||
>foo : () => IterableIterator<typeof foo>
|
||||
>foo : () => Generator<typeof foo, void, unknown>
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
yield(foo);
|
||||
>yield(foo) : any
|
||||
>yield : any
|
||||
>foo : () => IterableIterator<typeof foo>
|
||||
>foo : () => Generator<typeof foo, void, unknown>
|
||||
|
||||
function* foo() {
|
||||
>foo : () => IterableIterator<typeof foo>
|
||||
>foo : () => Generator<typeof foo, void, unknown>
|
||||
|
||||
yield(foo);
|
||||
>yield(foo) : any
|
||||
>(foo) : () => IterableIterator<typeof foo>
|
||||
>foo : () => IterableIterator<typeof foo>
|
||||
>(foo) : () => Generator<typeof foo, void, unknown>
|
||||
>foo : () => Generator<typeof foo, void, unknown>
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts ===
|
||||
var v = function*() {
|
||||
>v : () => IterableIterator<any>
|
||||
>function*() { yield(foo);} : () => IterableIterator<any>
|
||||
>v : () => Generator<any, void, unknown>
|
||||
>function*() { yield(foo);} : () => Generator<any, void, unknown>
|
||||
|
||||
yield(foo);
|
||||
>yield(foo) : any
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression3_es6.ts ===
|
||||
function *g() {
|
||||
>g : () => IterableIterator<any>
|
||||
>g : () => Generator<any, void, any>
|
||||
|
||||
yield *;
|
||||
>yield * : any
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts ===
|
||||
function *g() {
|
||||
>g : () => IterableIterator<any>
|
||||
>g : () => Generator<any, void, undefined>
|
||||
|
||||
yield * [];
|
||||
>yield * [] : any
|
||||
|
||||
+26
-21
@@ -53,7 +53,7 @@ declare namespace ts {
|
||||
interface Iterator<T> {
|
||||
next(): {
|
||||
value: T;
|
||||
done: false;
|
||||
done?: false;
|
||||
} | {
|
||||
value: never;
|
||||
done: true;
|
||||
@@ -72,7 +72,7 @@ declare namespace ts {
|
||||
pos: number;
|
||||
end: number;
|
||||
}
|
||||
type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind;
|
||||
type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind;
|
||||
type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword;
|
||||
type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
|
||||
enum SyntaxKind {
|
||||
@@ -379,23 +379,24 @@ declare namespace ts {
|
||||
JSDocSignature = 299,
|
||||
JSDocTag = 300,
|
||||
JSDocAugmentsTag = 301,
|
||||
JSDocClassTag = 302,
|
||||
JSDocCallbackTag = 303,
|
||||
JSDocEnumTag = 304,
|
||||
JSDocParameterTag = 305,
|
||||
JSDocReturnTag = 306,
|
||||
JSDocThisTag = 307,
|
||||
JSDocTypeTag = 308,
|
||||
JSDocTemplateTag = 309,
|
||||
JSDocTypedefTag = 310,
|
||||
JSDocPropertyTag = 311,
|
||||
SyntaxList = 312,
|
||||
NotEmittedStatement = 313,
|
||||
PartiallyEmittedExpression = 314,
|
||||
CommaListExpression = 315,
|
||||
MergeDeclarationMarker = 316,
|
||||
EndOfDeclarationMarker = 317,
|
||||
Count = 318,
|
||||
JSDocAuthorTag = 302,
|
||||
JSDocClassTag = 303,
|
||||
JSDocCallbackTag = 304,
|
||||
JSDocEnumTag = 305,
|
||||
JSDocParameterTag = 306,
|
||||
JSDocReturnTag = 307,
|
||||
JSDocThisTag = 308,
|
||||
JSDocTypeTag = 309,
|
||||
JSDocTemplateTag = 310,
|
||||
JSDocTypedefTag = 311,
|
||||
JSDocPropertyTag = 312,
|
||||
SyntaxList = 313,
|
||||
NotEmittedStatement = 314,
|
||||
PartiallyEmittedExpression = 315,
|
||||
CommaListExpression = 316,
|
||||
MergeDeclarationMarker = 317,
|
||||
EndOfDeclarationMarker = 318,
|
||||
Count = 319,
|
||||
FirstAssignment = 60,
|
||||
LastAssignment = 72,
|
||||
FirstCompoundAssignment = 61,
|
||||
@@ -422,9 +423,9 @@ declare namespace ts {
|
||||
LastBinaryOperator = 72,
|
||||
FirstNode = 149,
|
||||
FirstJSDocNode = 289,
|
||||
LastJSDocNode = 311,
|
||||
LastJSDocNode = 312,
|
||||
FirstJSDocTagNode = 300,
|
||||
LastJSDocTagNode = 311,
|
||||
LastJSDocTagNode = 312,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
@@ -1581,6 +1582,9 @@ declare namespace ts {
|
||||
expression: Identifier | PropertyAccessEntityNameExpression;
|
||||
};
|
||||
}
|
||||
interface JSDocAuthorTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocAuthorTag;
|
||||
}
|
||||
interface JSDocClassTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocClassTag;
|
||||
}
|
||||
@@ -3532,6 +3536,7 @@ declare namespace ts {
|
||||
function isJSDocFunctionType(node: Node): node is JSDocFunctionType;
|
||||
function isJSDocVariadicType(node: Node): node is JSDocVariadicType;
|
||||
function isJSDoc(node: Node): node is JSDoc;
|
||||
function isJSDocAuthorTag(node: Node): node is JSDocAuthorTag;
|
||||
function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
|
||||
function isJSDocClassTag(node: Node): node is JSDocClassTag;
|
||||
function isJSDocEnumTag(node: Node): node is JSDocEnumTag;
|
||||
|
||||
+26
-21
@@ -53,7 +53,7 @@ declare namespace ts {
|
||||
interface Iterator<T> {
|
||||
next(): {
|
||||
value: T;
|
||||
done: false;
|
||||
done?: false;
|
||||
} | {
|
||||
value: never;
|
||||
done: true;
|
||||
@@ -72,7 +72,7 @@ declare namespace ts {
|
||||
pos: number;
|
||||
end: number;
|
||||
}
|
||||
type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind;
|
||||
type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind;
|
||||
type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword;
|
||||
type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
|
||||
enum SyntaxKind {
|
||||
@@ -379,23 +379,24 @@ declare namespace ts {
|
||||
JSDocSignature = 299,
|
||||
JSDocTag = 300,
|
||||
JSDocAugmentsTag = 301,
|
||||
JSDocClassTag = 302,
|
||||
JSDocCallbackTag = 303,
|
||||
JSDocEnumTag = 304,
|
||||
JSDocParameterTag = 305,
|
||||
JSDocReturnTag = 306,
|
||||
JSDocThisTag = 307,
|
||||
JSDocTypeTag = 308,
|
||||
JSDocTemplateTag = 309,
|
||||
JSDocTypedefTag = 310,
|
||||
JSDocPropertyTag = 311,
|
||||
SyntaxList = 312,
|
||||
NotEmittedStatement = 313,
|
||||
PartiallyEmittedExpression = 314,
|
||||
CommaListExpression = 315,
|
||||
MergeDeclarationMarker = 316,
|
||||
EndOfDeclarationMarker = 317,
|
||||
Count = 318,
|
||||
JSDocAuthorTag = 302,
|
||||
JSDocClassTag = 303,
|
||||
JSDocCallbackTag = 304,
|
||||
JSDocEnumTag = 305,
|
||||
JSDocParameterTag = 306,
|
||||
JSDocReturnTag = 307,
|
||||
JSDocThisTag = 308,
|
||||
JSDocTypeTag = 309,
|
||||
JSDocTemplateTag = 310,
|
||||
JSDocTypedefTag = 311,
|
||||
JSDocPropertyTag = 312,
|
||||
SyntaxList = 313,
|
||||
NotEmittedStatement = 314,
|
||||
PartiallyEmittedExpression = 315,
|
||||
CommaListExpression = 316,
|
||||
MergeDeclarationMarker = 317,
|
||||
EndOfDeclarationMarker = 318,
|
||||
Count = 319,
|
||||
FirstAssignment = 60,
|
||||
LastAssignment = 72,
|
||||
FirstCompoundAssignment = 61,
|
||||
@@ -422,9 +423,9 @@ declare namespace ts {
|
||||
LastBinaryOperator = 72,
|
||||
FirstNode = 149,
|
||||
FirstJSDocNode = 289,
|
||||
LastJSDocNode = 311,
|
||||
LastJSDocNode = 312,
|
||||
FirstJSDocTagNode = 300,
|
||||
LastJSDocTagNode = 311,
|
||||
LastJSDocTagNode = 312,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
@@ -1581,6 +1582,9 @@ declare namespace ts {
|
||||
expression: Identifier | PropertyAccessEntityNameExpression;
|
||||
};
|
||||
}
|
||||
interface JSDocAuthorTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocAuthorTag;
|
||||
}
|
||||
interface JSDocClassTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocClassTag;
|
||||
}
|
||||
@@ -3532,6 +3536,7 @@ declare namespace ts {
|
||||
function isJSDocFunctionType(node: Node): node is JSDocFunctionType;
|
||||
function isJSDocVariadicType(node: Node): node is JSDocVariadicType;
|
||||
function isJSDoc(node: Node): node is JSDoc;
|
||||
function isJSDocAuthorTag(node: Node): node is JSDocAuthorTag;
|
||||
function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
|
||||
function isJSDocClassTag(node: Node): node is JSDocClassTag;
|
||||
function isJSDocEnumTag(node: Node): node is JSDocEnumTag;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/asyncImportNestedYield.ts ===
|
||||
async function* foo() {
|
||||
>foo : () => AsyncIterableIterator<string>
|
||||
>foo : () => AsyncGenerator<string, void, string>
|
||||
|
||||
import((await import(yield "foo")).default);
|
||||
>import((await import(yield "foo")).default) : Promise<any>
|
||||
|
||||
@@ -336,7 +336,7 @@ class B extends A {
|
||||
}
|
||||
|
||||
async * property_access_only_read_only_in_generator() {
|
||||
>property_access_only_read_only_in_generator : () => AsyncIterableIterator<any>
|
||||
>property_access_only_read_only_in_generator : () => AsyncGenerator<never, void, unknown>
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
@@ -372,7 +372,7 @@ class B extends A {
|
||||
}
|
||||
|
||||
async * property_access_only_write_only_in_generator() {
|
||||
>property_access_only_write_only_in_generator : () => AsyncIterableIterator<any>
|
||||
>property_access_only_write_only_in_generator : () => AsyncGenerator<never, void, unknown>
|
||||
|
||||
const f = () => {};
|
||||
>f : () => void
|
||||
@@ -420,7 +420,7 @@ class B extends A {
|
||||
}
|
||||
|
||||
async * element_access_only_read_only_in_generator() {
|
||||
>element_access_only_read_only_in_generator : () => AsyncIterableIterator<any>
|
||||
>element_access_only_read_only_in_generator : () => AsyncGenerator<never, void, unknown>
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
@@ -456,7 +456,7 @@ class B extends A {
|
||||
}
|
||||
|
||||
async * element_access_only_write_only_in_generator() {
|
||||
>element_access_only_write_only_in_generator : () => AsyncIterableIterator<any>
|
||||
>element_access_only_write_only_in_generator : () => AsyncGenerator<never, void, unknown>
|
||||
|
||||
const f = () => {};
|
||||
>f : () => void
|
||||
|
||||
@@ -57,7 +57,7 @@ const arrowFunc = (p: Promise<number>) => {
|
||||
};
|
||||
|
||||
function* generatorFunc(p: Promise<number>) {
|
||||
>generatorFunc : (p: Promise<number>) => IterableIterator<number>
|
||||
>generatorFunc : (p: Promise<number>) => Generator<number, void, unknown>
|
||||
>p : Promise<number>
|
||||
|
||||
for await (const _ of []);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/blockScopedBindingsInDownlevelGenerator.ts ===
|
||||
function* a() {
|
||||
>a : () => IterableIterator<number>
|
||||
>a : () => Generator<number, void, unknown>
|
||||
|
||||
for (const i of [1,2,3]) {
|
||||
>i : number
|
||||
|
||||
@@ -82,11 +82,11 @@ function foo6(y = () => (() => z)(), z = 1) {
|
||||
|
||||
// ok - used inside immediately invoked generator function
|
||||
function foo7(y = (function*() {yield z})(), z = 1) {
|
||||
>foo7 : (y?: IterableIterator<number>, z?: number) => void
|
||||
>y : IterableIterator<number>
|
||||
>(function*() {yield z})() : IterableIterator<number>
|
||||
>(function*() {yield z}) : () => IterableIterator<number>
|
||||
>function*() {yield z} : () => IterableIterator<number>
|
||||
>foo7 : (y?: Generator<number, void, unknown>, z?: number) => void
|
||||
>y : Generator<number, void, unknown>
|
||||
>(function*() {yield z})() : Generator<number, void, unknown>
|
||||
>(function*() {yield z}) : () => Generator<number, void, unknown>
|
||||
>function*() {yield z} : () => Generator<number, void, unknown>
|
||||
>yield z : any
|
||||
>z : number
|
||||
>z : number
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
error TS2318: Cannot find global type 'IterableIterator'.
|
||||
error TS2318: Cannot find global type 'Generator'.
|
||||
tests/cases/compiler/castOfYield.ts(4,14): error TS1109: Expression expected.
|
||||
|
||||
|
||||
!!! error TS2318: Cannot find global type 'IterableIterator'.
|
||||
!!! error TS2318: Cannot find global type 'Generator'.
|
||||
==== tests/cases/compiler/castOfYield.ts (1 errors) ====
|
||||
function* f() {
|
||||
<number> (yield 0);
|
||||
|
||||
@@ -21,7 +21,21 @@ export class Elem<
|
||||
new Elem(undefined as ElChildren.Void);
|
||||
new Elem('' as ElChildren.Text);
|
||||
new Elem('' as ElChildren.Void | ElChildren.Text); // error
|
||||
new Elem('' as ElChildren); // error
|
||||
new Elem('' as ElChildren); // error
|
||||
|
||||
// Repro from #31766
|
||||
|
||||
interface I { a: string }
|
||||
|
||||
type DeepPartial<T> =
|
||||
T extends object ? {[K in keyof T]?: DeepPartial<T[K]>} : T;
|
||||
|
||||
declare function f<T>(t: T, partial: DeepPartial<T>): T;
|
||||
|
||||
function g(p1: I, p2: Partial<I>): I {
|
||||
return f(p1, p2);
|
||||
}
|
||||
|
||||
|
||||
//// [conditionalTypeRelaxingConstraintAssignability.js]
|
||||
"use strict";
|
||||
@@ -37,3 +51,6 @@ new Elem(undefined);
|
||||
new Elem('');
|
||||
new Elem(''); // error
|
||||
new Elem(''); // error
|
||||
function g(p1, p2) {
|
||||
return f(p1, p2);
|
||||
}
|
||||
|
||||
@@ -71,3 +71,47 @@ new Elem('' as ElChildren); // error
|
||||
>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83))
|
||||
>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20))
|
||||
|
||||
// Repro from #31766
|
||||
|
||||
interface I { a: string }
|
||||
>I : Symbol(I, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 22, 27))
|
||||
>a : Symbol(I.a, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 26, 13))
|
||||
|
||||
type DeepPartial<T> =
|
||||
>DeepPartial : Symbol(DeepPartial, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 26, 25))
|
||||
>T : Symbol(T, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 28, 17))
|
||||
|
||||
T extends object ? {[K in keyof T]?: DeepPartial<T[K]>} : T;
|
||||
>T : Symbol(T, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 28, 17))
|
||||
>K : Symbol(K, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 29, 25))
|
||||
>T : Symbol(T, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 28, 17))
|
||||
>DeepPartial : Symbol(DeepPartial, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 26, 25))
|
||||
>T : Symbol(T, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 28, 17))
|
||||
>K : Symbol(K, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 29, 25))
|
||||
>T : Symbol(T, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 28, 17))
|
||||
|
||||
declare function f<T>(t: T, partial: DeepPartial<T>): T;
|
||||
>f : Symbol(f, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 29, 64))
|
||||
>T : Symbol(T, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 31, 19))
|
||||
>t : Symbol(t, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 31, 22))
|
||||
>T : Symbol(T, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 31, 19))
|
||||
>partial : Symbol(partial, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 31, 27))
|
||||
>DeepPartial : Symbol(DeepPartial, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 26, 25))
|
||||
>T : Symbol(T, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 31, 19))
|
||||
>T : Symbol(T, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 31, 19))
|
||||
|
||||
function g(p1: I, p2: Partial<I>): I {
|
||||
>g : Symbol(g, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 31, 56))
|
||||
>p1 : Symbol(p1, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 33, 11))
|
||||
>I : Symbol(I, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 22, 27))
|
||||
>p2 : Symbol(p2, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 33, 17))
|
||||
>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --))
|
||||
>I : Symbol(I, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 22, 27))
|
||||
>I : Symbol(I, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 22, 27))
|
||||
|
||||
return f(p1, p2);
|
||||
>f : Symbol(f, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 29, 64))
|
||||
>p1 : Symbol(p1, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 33, 11))
|
||||
>p2 : Symbol(p2, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 33, 17))
|
||||
}
|
||||
|
||||
|
||||
@@ -62,3 +62,30 @@ new Elem('' as ElChildren); // error
|
||||
>'' as ElChildren : ElChildren
|
||||
>'' : ""
|
||||
|
||||
// Repro from #31766
|
||||
|
||||
interface I { a: string }
|
||||
>a : string
|
||||
|
||||
type DeepPartial<T> =
|
||||
>DeepPartial : DeepPartial<T>
|
||||
|
||||
T extends object ? {[K in keyof T]?: DeepPartial<T[K]>} : T;
|
||||
|
||||
declare function f<T>(t: T, partial: DeepPartial<T>): T;
|
||||
>f : <T>(t: T, partial: DeepPartial<T>) => T
|
||||
>t : T
|
||||
>partial : DeepPartial<T>
|
||||
|
||||
function g(p1: I, p2: Partial<I>): I {
|
||||
>g : (p1: I, p2: Partial<I>) => I
|
||||
>p1 : I
|
||||
>p2 : Partial<I>
|
||||
|
||||
return f(p1, p2);
|
||||
>f(p1, p2) : I
|
||||
>f : <T>(t: T, partial: DeepPartial<T>) => T
|
||||
>p1 : I
|
||||
>p2 : Partial<I>
|
||||
}
|
||||
|
||||
|
||||
@@ -181,9 +181,9 @@ function f5() {
|
||||
>v : number
|
||||
|
||||
(function*() {
|
||||
>(function*() { yield 1; v = 1; })() : IterableIterator<number>
|
||||
>(function*() { yield 1; v = 1; }) : () => IterableIterator<number>
|
||||
>function*() { yield 1; v = 1; } : () => IterableIterator<number>
|
||||
>(function*() { yield 1; v = 1; })() : Generator<number, void, unknown>
|
||||
>(function*() { yield 1; v = 1; }) : () => Generator<number, void, unknown>
|
||||
>function*() { yield 1; v = 1; } : () => Generator<number, void, unknown>
|
||||
|
||||
yield 1;
|
||||
>yield 1 : any
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,6): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,11): error TS2493: Tuple type '[]' of length '0' has no element at index '1'.
|
||||
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,16): error TS2493: Tuple type '[]' of length '0' has no element at index '2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts (3 errors) ====
|
||||
@@ -9,11 +9,11 @@ tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,16): error T
|
||||
var [x11 = 0, y11 = ""] = [1, "hello"];
|
||||
var [a11, b11, c11] = [];
|
||||
~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '1'.
|
||||
~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '2'.
|
||||
|
||||
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ var _m = [[x13, y13], { x: x13, y: y13 }], a3 = _m[0], b3 = _m[1];
|
||||
//// [declarationEmitDestructuringArrayPattern2.d.ts]
|
||||
declare var x10: number, y10: string, z10: boolean;
|
||||
declare var x11: number, y11: string;
|
||||
declare var a11: any, b11: any, c11: any;
|
||||
declare var a11: undefined, b11: undefined, c11: undefined;
|
||||
declare var a2: number, b2: string, x12: number, c2: boolean;
|
||||
declare var x13: number, y13: string;
|
||||
declare var a3: (string | number)[], b3: {
|
||||
|
||||
@@ -20,10 +20,10 @@ var [x11 = 0, y11 = ""] = [1, "hello"];
|
||||
>"hello" : "hello"
|
||||
|
||||
var [a11, b11, c11] = [];
|
||||
>a11 : any
|
||||
>b11 : any
|
||||
>c11 : any
|
||||
>[] : [undefined?, undefined?, undefined?]
|
||||
>a11 : undefined
|
||||
>b11 : undefined
|
||||
>c11 : undefined
|
||||
>[] : []
|
||||
|
||||
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
|
||||
>a2 : number
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2493: Tuple type '[number, string]' of length '2' has no element at index '2'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(22,17): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(22,23): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(23,25): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
|
||||
@@ -6,11 +6,11 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(24,19):
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(28,28): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(29,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(58,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | number', but here has type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,10): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,10): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): error TS2493: Tuple type '[]' of length '0' has no element at index '1'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2493: Tuple type '[]' of length '0' has no element at index '2'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2493: Tuple type '[number]' of length '1' has no element at index '1'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2493: Tuple type '[number]' of length '1' has no element at index '2'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(67,9): error TS2461: Type '{}' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(68,9): error TS2461: Type '{ 0: number; 1: number; }' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
@@ -29,7 +29,7 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
|
||||
var [x, y] = [1, "hello"];
|
||||
var [x, y, z] = [1, "hello"];
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[number, string]' of length '2' has no element at index '2'.
|
||||
var [,, x] = [0, 1, 2];
|
||||
var x: number;
|
||||
var y: string;
|
||||
@@ -103,16 +103,16 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
|
||||
function f8() {
|
||||
var [a, b, c] = []; // Error, [] is an empty tuple
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '1'.
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '2'.
|
||||
var [d, e, f] = [1]; // Error, [1] is a tuple
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[number]' of length '1' has no element at index '1'.
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[number]' of length '1' has no element at index '2'.
|
||||
}
|
||||
|
||||
function f9() {
|
||||
|
||||
@@ -23,8 +23,8 @@ function f0() {
|
||||
var [x, y, z] = [1, "hello"];
|
||||
>x : number
|
||||
>y : string
|
||||
>z : any
|
||||
>[1, "hello"] : [number, string, undefined?]
|
||||
>z : undefined
|
||||
>[1, "hello"] : [number, string]
|
||||
>1 : 1
|
||||
>"hello" : "hello"
|
||||
|
||||
@@ -255,16 +255,16 @@ function f8() {
|
||||
>f8 : () => void
|
||||
|
||||
var [a, b, c] = []; // Error, [] is an empty tuple
|
||||
>a : any
|
||||
>b : any
|
||||
>c : any
|
||||
>[] : [undefined?, undefined?, undefined?]
|
||||
>a : undefined
|
||||
>b : undefined
|
||||
>c : undefined
|
||||
>[] : []
|
||||
|
||||
var [d, e, f] = [1]; // Error, [1] is a tuple
|
||||
>d : number
|
||||
>e : any
|
||||
>f : any
|
||||
>[1] : [number, undefined?, undefined?]
|
||||
>e : undefined
|
||||
>f : undefined
|
||||
>[1] : [number]
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(43,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(43,6): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,18): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts (3 errors) ====
|
||||
@@ -48,12 +48,12 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
var [c0, c1] = [...temp];
|
||||
var [c2] = [];
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
var [, c7] = [1, 2, 3];
|
||||
var [,,, c8] = [1, 2, 3, 4];
|
||||
|
||||
@@ -92,19 +92,19 @@ var [c0, c1] = [...temp];
|
||||
>temp : number[]
|
||||
|
||||
var [c2] = [];
|
||||
>c2 : any
|
||||
>[] : [undefined?]
|
||||
>c2 : undefined
|
||||
>[] : []
|
||||
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
>c3 : any
|
||||
>c4 : any
|
||||
>[[[]], [[[[]]]]] : [[[undefined?]], [[[[undefined?]]]]]
|
||||
>[[]] : [[undefined?]]
|
||||
>[] : [undefined?]
|
||||
>[[[[]]]] : [[[[undefined?]]]]
|
||||
>[[[]]] : [[[undefined?]]]
|
||||
>[[]] : [[undefined?]]
|
||||
>[] : [undefined?]
|
||||
>c3 : undefined
|
||||
>c4 : undefined
|
||||
>[[[]], [[[[]]]]] : [[[]], [[[[]]]]]
|
||||
>[[]] : [[]]
|
||||
>[] : []
|
||||
>[[[[]]]] : [[[[]]]]
|
||||
>[[[]]] : [[[]]]
|
||||
>[[]] : [[]]
|
||||
>[] : []
|
||||
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
>c5 : string | number
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(43,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(44,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(44,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(43,6): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(44,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(44,18): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts (3 errors) ====
|
||||
@@ -48,12 +48,12 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
var [c0, c1] = [...temp];
|
||||
var [c2] = [];
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
var [, c7] = [1, 2, 3];
|
||||
var [,,, c8] = [1, 2, 3, 4];
|
||||
|
||||
+11
-11
@@ -92,19 +92,19 @@ var [c0, c1] = [...temp];
|
||||
>temp : number[]
|
||||
|
||||
var [c2] = [];
|
||||
>c2 : any
|
||||
>[] : [undefined?]
|
||||
>c2 : undefined
|
||||
>[] : []
|
||||
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
>c3 : any
|
||||
>c4 : any
|
||||
>[[[]], [[[[]]]]] : [[[undefined?]], [[[[undefined?]]]]]
|
||||
>[[]] : [[undefined?]]
|
||||
>[] : [undefined?]
|
||||
>[[[[]]]] : [[[[undefined?]]]]
|
||||
>[[[]]] : [[[undefined?]]]
|
||||
>[[]] : [[undefined?]]
|
||||
>[] : [undefined?]
|
||||
>c3 : undefined
|
||||
>c4 : undefined
|
||||
>[[[]], [[[[]]]]] : [[[]], [[[[]]]]]
|
||||
>[[]] : [[]]
|
||||
>[] : []
|
||||
>[[[[]]]] : [[[[]]]]
|
||||
>[[[]]] : [[[]]]
|
||||
>[[]] : [[]]
|
||||
>[] : []
|
||||
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
>c5 : string | number
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(43,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(44,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(44,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(43,6): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(44,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(44,18): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts (3 errors) ====
|
||||
@@ -48,12 +48,12 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
var [c0, c1] = [...temp];
|
||||
var [c2] = [];
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
var [, c7] = [1, 2, 3];
|
||||
var [,,, c8] = [1, 2, 3, 4];
|
||||
|
||||
@@ -92,19 +92,19 @@ var [c0, c1] = [...temp];
|
||||
>temp : number[]
|
||||
|
||||
var [c2] = [];
|
||||
>c2 : any
|
||||
>[] : [undefined?]
|
||||
>c2 : undefined
|
||||
>[] : []
|
||||
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
>c3 : any
|
||||
>c4 : any
|
||||
>[[[]], [[[[]]]]] : [[[undefined?]], [[[[undefined?]]]]]
|
||||
>[[]] : [[undefined?]]
|
||||
>[] : [undefined?]
|
||||
>[[[[]]]] : [[[[undefined?]]]]
|
||||
>[[[]]] : [[[undefined?]]]
|
||||
>[[]] : [[undefined?]]
|
||||
>[] : [undefined?]
|
||||
>c3 : undefined
|
||||
>c4 : undefined
|
||||
>[[[]], [[[[]]]]] : [[[]], [[[[]]]]]
|
||||
>[[]] : [[]]
|
||||
>[] : []
|
||||
>[[[[]]]] : [[[[]]]]
|
||||
>[[[]]] : [[[]]]
|
||||
>[[]] : [[]]
|
||||
>[] : []
|
||||
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
>c5 : string | number
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,6): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,6): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2493: Tuple type '[]' of length '0' has no element at index '1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(4,5): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,51): error TS2322: Type 'number' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(22,5): error TS2739: Type 'number[]' is missing the following properties from type '[number, number]': 0, 1
|
||||
@@ -16,11 +16,11 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
~~~~
|
||||
!!! error TS2461: Type 'undefined' is not an array type.
|
||||
~~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
~~~~~~
|
||||
!!! error TS2461: Type 'undefined' is not an array type.
|
||||
~~~~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '1'.
|
||||
var [[a2], [[a3]]] = undefined // Error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2461: Type 'undefined' is not an array type.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
var [[a0], [[a1]]] = [] // Error
|
||||
>a0 : any
|
||||
>a1 : any
|
||||
>[] : [undefined?, undefined?]
|
||||
>[] : []
|
||||
|
||||
var [[a2], [[a3]]] = undefined // Error
|
||||
>a2 : any
|
||||
|
||||
@@ -3,7 +3,7 @@ const [a, b = a] = [1]; // ok
|
||||
>a : any
|
||||
>b : any
|
||||
>a : any
|
||||
>[1] : [number, any?]
|
||||
>[1] : [number]
|
||||
>1 : 1
|
||||
|
||||
const [c, d = c, e = e] = [1]; // error for e = e
|
||||
@@ -12,7 +12,7 @@ const [c, d = c, e = e] = [1]; // error for e = e
|
||||
>c : any
|
||||
>e : any
|
||||
>e : any
|
||||
>[1] : [number, any?, any?]
|
||||
>[1] : [number]
|
||||
>1 : 1
|
||||
|
||||
const [f, g = f, h = i, i = f] = [1]; // error for h = i
|
||||
@@ -23,7 +23,7 @@ const [f, g = f, h = i, i = f] = [1]; // error for h = i
|
||||
>i : any
|
||||
>i : any
|
||||
>f : any
|
||||
>[1] : [number, any?, any?, any?]
|
||||
>[1] : [number]
|
||||
>1 : 1
|
||||
|
||||
(function ([a, b = a]) { // ok
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
tests/cases/compiler/destructuringTuple.ts(11,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/compiler/destructuringTuple.ts(11,60): error TS2345: Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/destructuringTuple.ts (2 errors) ====
|
||||
declare var tuple: [boolean, number, ...string[]];
|
||||
|
||||
const [a, b, c, ...rest] = tuple;
|
||||
|
||||
declare var receiver: typeof tuple;
|
||||
|
||||
[...receiver] = tuple;
|
||||
|
||||
// Repros from #32140
|
||||
|
||||
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
|
||||
~~~~~
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
|
||||
|
||||
const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);
|
||||
|
||||
@@ -6,9 +6,18 @@ const [a, b, c, ...rest] = tuple;
|
||||
declare var receiver: typeof tuple;
|
||||
|
||||
[...receiver] = tuple;
|
||||
|
||||
// Repros from #32140
|
||||
|
||||
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
|
||||
|
||||
const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);
|
||||
|
||||
|
||||
//// [destructuringTuple.js]
|
||||
"use strict";
|
||||
var a = tuple[0], b = tuple[1], c = tuple[2], rest = tuple.slice(3);
|
||||
receiver = tuple.slice(0);
|
||||
// Repros from #32140
|
||||
var oops1 = [1, 2, 3].reduce(function (accu, el) { return accu.concat(el); }, [])[0];
|
||||
var oops2 = [1, 2, 3].reduce(function (acc, e) { return acc.concat(e); }, [])[0];
|
||||
|
||||
@@ -17,3 +17,27 @@ declare var receiver: typeof tuple;
|
||||
>receiver : Symbol(receiver, Decl(destructuringTuple.ts, 4, 11))
|
||||
>tuple : Symbol(tuple, Decl(destructuringTuple.ts, 0, 11))
|
||||
|
||||
// Repros from #32140
|
||||
|
||||
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
|
||||
>oops1 : Symbol(oops1, Decl(destructuringTuple.ts, 10, 7))
|
||||
>[1, 2, 3].reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>accu : Symbol(accu, Decl(destructuringTuple.ts, 10, 34))
|
||||
>el : Symbol(el, Decl(destructuringTuple.ts, 10, 39))
|
||||
>accu.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>accu : Symbol(accu, Decl(destructuringTuple.ts, 10, 34))
|
||||
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>el : Symbol(el, Decl(destructuringTuple.ts, 10, 39))
|
||||
|
||||
const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);
|
||||
>oops2 : Symbol(oops2, Decl(destructuringTuple.ts, 12, 7))
|
||||
>[1, 2, 3].reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>acc : Symbol(acc, Decl(destructuringTuple.ts, 12, 34))
|
||||
>e : Symbol(e, Decl(destructuringTuple.ts, 12, 48))
|
||||
>acc.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>acc : Symbol(acc, Decl(destructuringTuple.ts, 12, 34))
|
||||
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>e : Symbol(e, Decl(destructuringTuple.ts, 12, 48))
|
||||
|
||||
|
||||
@@ -20,3 +20,43 @@ declare var receiver: typeof tuple;
|
||||
>receiver : [boolean, number, ...string[]]
|
||||
>tuple : [boolean, number, ...string[]]
|
||||
|
||||
// Repros from #32140
|
||||
|
||||
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
|
||||
>oops1 : undefined
|
||||
>[1, 2, 3].reduce((accu, el) => accu.concat(el), []) : []
|
||||
>[1, 2, 3].reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
>reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
|
||||
>(accu, el) => accu.concat(el) : (accu: [], el: number) => any
|
||||
>accu : []
|
||||
>el : number
|
||||
>accu.concat(el) : any
|
||||
>accu.concat : { (...items: ConcatArray<never>[]): never[]; (...items: ConcatArray<never>[]): never[]; }
|
||||
>accu : []
|
||||
>concat : { (...items: ConcatArray<never>[]): never[]; (...items: ConcatArray<never>[]): never[]; }
|
||||
>el : number
|
||||
>[] : []
|
||||
|
||||
const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);
|
||||
>oops2 : number
|
||||
>[1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []) : number[]
|
||||
>[1, 2, 3].reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
>reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
|
||||
>(acc: number[], e) => acc.concat(e) : (acc: number[], e: number) => number[]
|
||||
>acc : number[]
|
||||
>e : number
|
||||
>acc.concat(e) : number[]
|
||||
>acc.concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
|
||||
>acc : number[]
|
||||
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
|
||||
>e : number
|
||||
>[] : never[]
|
||||
|
||||
|
||||
@@ -151,9 +151,9 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
|
||||
>f4 : number
|
||||
>f5 : number
|
||||
> : undefined
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, undefined?]; }
|
||||
>f : [number, number, { f3: number; f5: number; }, undefined?]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, undefined?]
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }]; }
|
||||
>f : [number, number, { f3: number; f5: number; }]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>{ f3: 4, f5: 0 } : { f3: number; f5: number; }
|
||||
|
||||
@@ -151,9 +151,9 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
|
||||
>f4 : number
|
||||
>f5 : number
|
||||
> : undefined
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, undefined?]; }
|
||||
>f : [number, number, { f3: number; f5: number; }, undefined?]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, undefined?]
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }]; }
|
||||
>f : [number, number, { f3: number; f5: number; }]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>{ f3: 4, f5: 0 } : { f3: number; f5: number; }
|
||||
|
||||
@@ -151,9 +151,9 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
|
||||
>f4 : number
|
||||
>f5 : number
|
||||
> : undefined
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, undefined?]; }
|
||||
>f : [number, number, { f3: number; f5: number; }, undefined?]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, undefined?]
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }]; }
|
||||
>f : [number, number, { f3: number; f5: number; }]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>{ f3: 4, f5: 0 } : { f3: number; f5: number; }
|
||||
|
||||
@@ -60,7 +60,7 @@ var [c1, c2, { c3: c4, c5 }, , ...c6] = [1, 2, { c3: 4, c5: 0 }]; // Error
|
||||
>c5 : number
|
||||
> : undefined
|
||||
>c6 : []
|
||||
>[1, 2, { c3: 4, c5: 0 }] : [number, number, { c3: number; c5: number; }, undefined?]
|
||||
>[1, 2, { c3: 4, c5: 0 }] : [number, number, { c3: number; c5: number; }]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>{ c3: 4, c5: 0 } : { c3: number; c5: number; }
|
||||
|
||||
@@ -274,7 +274,7 @@ function g4([x, y = 0] = [0]) { }
|
||||
>x : number
|
||||
>y : number
|
||||
>0 : 0
|
||||
>[0] : [number, number?]
|
||||
>[0] : [number]
|
||||
>0 : 0
|
||||
|
||||
g4();
|
||||
@@ -295,7 +295,7 @@ function g5([x = 0, y = 0] = []) { }
|
||||
>0 : 0
|
||||
>y : number
|
||||
>0 : 0
|
||||
>[] : [number?, number?]
|
||||
>[] : []
|
||||
|
||||
g5();
|
||||
>g5() : void
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(1,15): error TS7031: Binding element 'x' implicitly has an 'any' type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(1,18): error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(2,15): error TS7031: Binding element 'x' implicitly has an 'any' type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(2,18): error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(3,18): error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(6,22): error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(7,22): error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(8,22): error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts (8 errors) ====
|
||||
function f00([x, y]) {}
|
||||
~
|
||||
!!! error TS7031: Binding element 'x' implicitly has an 'any' type.
|
||||
~
|
||||
!!! error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
function f01([x, y] = []) {}
|
||||
~
|
||||
!!! error TS7031: Binding element 'x' implicitly has an 'any' type.
|
||||
~
|
||||
!!! error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
function f02([x, y] = [1]) {}
|
||||
~
|
||||
!!! error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
function f03([x, y] = [1, 'foo']) {}
|
||||
|
||||
function f10([x = 0, y]) {}
|
||||
~
|
||||
!!! error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
function f11([x = 0, y] = []) {}
|
||||
~
|
||||
!!! error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
function f12([x = 0, y] = [1]) {}
|
||||
~
|
||||
!!! error TS7031: Binding element 'y' implicitly has an 'any' type.
|
||||
function f13([x = 0, y] = [1, 'foo']) {}
|
||||
|
||||
function f20([x = 0, y = 'bar']) {}
|
||||
function f21([x = 0, y = 'bar'] = []) {}
|
||||
function f22([x = 0, y = 'bar'] = [1]) {}
|
||||
function f23([x = 0, y = 'bar'] = [1, 'foo']) {}
|
||||
|
||||
declare const nx: number | undefined;
|
||||
declare const sx: string | undefined;
|
||||
|
||||
function f30([x = 0, y = 'bar']) {}
|
||||
function f31([x = 0, y = 'bar'] = []) {}
|
||||
function f32([x = 0, y = 'bar'] = [nx]) {}
|
||||
function f33([x = 0, y = 'bar'] = [nx, sx]) {}
|
||||
|
||||
function f40([x = 0, y = 'bar']) {}
|
||||
function f41([x = 0, y = 'bar'] = []) {}
|
||||
function f42([x = 0, y = 'bar'] = [sx]) {}
|
||||
function f43([x = 0, y = 'bar'] = [sx, nx]) {}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//// [destructuringWithLiteralInitializers2.ts]
|
||||
function f00([x, y]) {}
|
||||
function f01([x, y] = []) {}
|
||||
function f02([x, y] = [1]) {}
|
||||
function f03([x, y] = [1, 'foo']) {}
|
||||
|
||||
function f10([x = 0, y]) {}
|
||||
function f11([x = 0, y] = []) {}
|
||||
function f12([x = 0, y] = [1]) {}
|
||||
function f13([x = 0, y] = [1, 'foo']) {}
|
||||
|
||||
function f20([x = 0, y = 'bar']) {}
|
||||
function f21([x = 0, y = 'bar'] = []) {}
|
||||
function f22([x = 0, y = 'bar'] = [1]) {}
|
||||
function f23([x = 0, y = 'bar'] = [1, 'foo']) {}
|
||||
|
||||
declare const nx: number | undefined;
|
||||
declare const sx: string | undefined;
|
||||
|
||||
function f30([x = 0, y = 'bar']) {}
|
||||
function f31([x = 0, y = 'bar'] = []) {}
|
||||
function f32([x = 0, y = 'bar'] = [nx]) {}
|
||||
function f33([x = 0, y = 'bar'] = [nx, sx]) {}
|
||||
|
||||
function f40([x = 0, y = 'bar']) {}
|
||||
function f41([x = 0, y = 'bar'] = []) {}
|
||||
function f42([x = 0, y = 'bar'] = [sx]) {}
|
||||
function f43([x = 0, y = 'bar'] = [sx, nx]) {}
|
||||
|
||||
|
||||
//// [destructuringWithLiteralInitializers2.js]
|
||||
"use strict";
|
||||
function f00(_a) {
|
||||
var x = _a[0], y = _a[1];
|
||||
}
|
||||
function f01(_a) {
|
||||
var _b = _a === void 0 ? [] : _a, x = _b[0], y = _b[1];
|
||||
}
|
||||
function f02(_a) {
|
||||
var _b = _a === void 0 ? [1] : _a, x = _b[0], y = _b[1];
|
||||
}
|
||||
function f03(_a) {
|
||||
var _b = _a === void 0 ? [1, 'foo'] : _a, x = _b[0], y = _b[1];
|
||||
}
|
||||
function f10(_a) {
|
||||
var _b = _a[0], x = _b === void 0 ? 0 : _b, y = _a[1];
|
||||
}
|
||||
function f11(_a) {
|
||||
var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, y = _b[1];
|
||||
}
|
||||
function f12(_a) {
|
||||
var _b = _a === void 0 ? [1] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, y = _b[1];
|
||||
}
|
||||
function f13(_a) {
|
||||
var _b = _a === void 0 ? [1, 'foo'] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, y = _b[1];
|
||||
}
|
||||
function f20(_a) {
|
||||
var _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 'bar' : _c;
|
||||
}
|
||||
function f21(_a) {
|
||||
var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d;
|
||||
}
|
||||
function f22(_a) {
|
||||
var _b = _a === void 0 ? [1] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d;
|
||||
}
|
||||
function f23(_a) {
|
||||
var _b = _a === void 0 ? [1, 'foo'] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d;
|
||||
}
|
||||
function f30(_a) {
|
||||
var _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 'bar' : _c;
|
||||
}
|
||||
function f31(_a) {
|
||||
var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d;
|
||||
}
|
||||
function f32(_a) {
|
||||
var _b = _a === void 0 ? [nx] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d;
|
||||
}
|
||||
function f33(_a) {
|
||||
var _b = _a === void 0 ? [nx, sx] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d;
|
||||
}
|
||||
function f40(_a) {
|
||||
var _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 'bar' : _c;
|
||||
}
|
||||
function f41(_a) {
|
||||
var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d;
|
||||
}
|
||||
function f42(_a) {
|
||||
var _b = _a === void 0 ? [sx] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d;
|
||||
}
|
||||
function f43(_a) {
|
||||
var _b = _a === void 0 ? [sx, nx] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d;
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts ===
|
||||
function f00([x, y]) {}
|
||||
>f00 : Symbol(f00, Decl(destructuringWithLiteralInitializers2.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 0, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 0, 16))
|
||||
|
||||
function f01([x, y] = []) {}
|
||||
>f01 : Symbol(f01, Decl(destructuringWithLiteralInitializers2.ts, 0, 23))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 1, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 1, 16))
|
||||
|
||||
function f02([x, y] = [1]) {}
|
||||
>f02 : Symbol(f02, Decl(destructuringWithLiteralInitializers2.ts, 1, 28))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 2, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 2, 16))
|
||||
|
||||
function f03([x, y] = [1, 'foo']) {}
|
||||
>f03 : Symbol(f03, Decl(destructuringWithLiteralInitializers2.ts, 2, 29))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 3, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 3, 16))
|
||||
|
||||
function f10([x = 0, y]) {}
|
||||
>f10 : Symbol(f10, Decl(destructuringWithLiteralInitializers2.ts, 3, 36))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 5, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 5, 20))
|
||||
|
||||
function f11([x = 0, y] = []) {}
|
||||
>f11 : Symbol(f11, Decl(destructuringWithLiteralInitializers2.ts, 5, 27))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 6, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 6, 20))
|
||||
|
||||
function f12([x = 0, y] = [1]) {}
|
||||
>f12 : Symbol(f12, Decl(destructuringWithLiteralInitializers2.ts, 6, 32))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 7, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 7, 20))
|
||||
|
||||
function f13([x = 0, y] = [1, 'foo']) {}
|
||||
>f13 : Symbol(f13, Decl(destructuringWithLiteralInitializers2.ts, 7, 33))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 8, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 8, 20))
|
||||
|
||||
function f20([x = 0, y = 'bar']) {}
|
||||
>f20 : Symbol(f20, Decl(destructuringWithLiteralInitializers2.ts, 8, 40))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 10, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 10, 20))
|
||||
|
||||
function f21([x = 0, y = 'bar'] = []) {}
|
||||
>f21 : Symbol(f21, Decl(destructuringWithLiteralInitializers2.ts, 10, 35))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 11, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 11, 20))
|
||||
|
||||
function f22([x = 0, y = 'bar'] = [1]) {}
|
||||
>f22 : Symbol(f22, Decl(destructuringWithLiteralInitializers2.ts, 11, 40))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 12, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 12, 20))
|
||||
|
||||
function f23([x = 0, y = 'bar'] = [1, 'foo']) {}
|
||||
>f23 : Symbol(f23, Decl(destructuringWithLiteralInitializers2.ts, 12, 41))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 13, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 13, 20))
|
||||
|
||||
declare const nx: number | undefined;
|
||||
>nx : Symbol(nx, Decl(destructuringWithLiteralInitializers2.ts, 15, 13))
|
||||
|
||||
declare const sx: string | undefined;
|
||||
>sx : Symbol(sx, Decl(destructuringWithLiteralInitializers2.ts, 16, 13))
|
||||
|
||||
function f30([x = 0, y = 'bar']) {}
|
||||
>f30 : Symbol(f30, Decl(destructuringWithLiteralInitializers2.ts, 16, 37))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 18, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 18, 20))
|
||||
|
||||
function f31([x = 0, y = 'bar'] = []) {}
|
||||
>f31 : Symbol(f31, Decl(destructuringWithLiteralInitializers2.ts, 18, 35))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 19, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 19, 20))
|
||||
|
||||
function f32([x = 0, y = 'bar'] = [nx]) {}
|
||||
>f32 : Symbol(f32, Decl(destructuringWithLiteralInitializers2.ts, 19, 40))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 20, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 20, 20))
|
||||
>nx : Symbol(nx, Decl(destructuringWithLiteralInitializers2.ts, 15, 13))
|
||||
|
||||
function f33([x = 0, y = 'bar'] = [nx, sx]) {}
|
||||
>f33 : Symbol(f33, Decl(destructuringWithLiteralInitializers2.ts, 20, 42))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 21, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 21, 20))
|
||||
>nx : Symbol(nx, Decl(destructuringWithLiteralInitializers2.ts, 15, 13))
|
||||
>sx : Symbol(sx, Decl(destructuringWithLiteralInitializers2.ts, 16, 13))
|
||||
|
||||
function f40([x = 0, y = 'bar']) {}
|
||||
>f40 : Symbol(f40, Decl(destructuringWithLiteralInitializers2.ts, 21, 46))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 23, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 23, 20))
|
||||
|
||||
function f41([x = 0, y = 'bar'] = []) {}
|
||||
>f41 : Symbol(f41, Decl(destructuringWithLiteralInitializers2.ts, 23, 35))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 24, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 24, 20))
|
||||
|
||||
function f42([x = 0, y = 'bar'] = [sx]) {}
|
||||
>f42 : Symbol(f42, Decl(destructuringWithLiteralInitializers2.ts, 24, 40))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 25, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 25, 20))
|
||||
>sx : Symbol(sx, Decl(destructuringWithLiteralInitializers2.ts, 16, 13))
|
||||
|
||||
function f43([x = 0, y = 'bar'] = [sx, nx]) {}
|
||||
>f43 : Symbol(f43, Decl(destructuringWithLiteralInitializers2.ts, 25, 42))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 26, 14))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 26, 20))
|
||||
>sx : Symbol(sx, Decl(destructuringWithLiteralInitializers2.ts, 16, 13))
|
||||
>nx : Symbol(nx, Decl(destructuringWithLiteralInitializers2.ts, 15, 13))
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts ===
|
||||
function f00([x, y]) {}
|
||||
>f00 : ([x, y]: [any, any]) => void
|
||||
>x : any
|
||||
>y : any
|
||||
|
||||
function f01([x, y] = []) {}
|
||||
>f01 : ([x, y]?: [any?, any?]) => void
|
||||
>x : any
|
||||
>y : any
|
||||
>[] : []
|
||||
|
||||
function f02([x, y] = [1]) {}
|
||||
>f02 : ([x, y]?: [number, any?]) => void
|
||||
>x : number
|
||||
>y : any
|
||||
>[1] : [number]
|
||||
>1 : 1
|
||||
|
||||
function f03([x, y] = [1, 'foo']) {}
|
||||
>f03 : ([x, y]?: [number, string]) => void
|
||||
>x : number
|
||||
>y : string
|
||||
>[1, 'foo'] : [number, string]
|
||||
>1 : 1
|
||||
>'foo' : "foo"
|
||||
|
||||
function f10([x = 0, y]) {}
|
||||
>f10 : ([x, y]: [number | undefined, any]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : any
|
||||
|
||||
function f11([x = 0, y] = []) {}
|
||||
>f11 : ([x, y]?: [(number | undefined)?, any?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : any
|
||||
>[] : []
|
||||
|
||||
function f12([x = 0, y] = [1]) {}
|
||||
>f12 : ([x, y]?: [number, any?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : any
|
||||
>[1] : [number]
|
||||
>1 : 1
|
||||
|
||||
function f13([x = 0, y] = [1, 'foo']) {}
|
||||
>f13 : ([x, y]?: [number, string]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>[1, 'foo'] : [number, string]
|
||||
>1 : 1
|
||||
>'foo' : "foo"
|
||||
|
||||
function f20([x = 0, y = 'bar']) {}
|
||||
>f20 : ([x, y]: [(number | undefined)?, (string | undefined)?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
|
||||
function f21([x = 0, y = 'bar'] = []) {}
|
||||
>f21 : ([x, y]?: [(number | undefined)?, (string | undefined)?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
>[] : []
|
||||
|
||||
function f22([x = 0, y = 'bar'] = [1]) {}
|
||||
>f22 : ([x, y]?: [number, (string | undefined)?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
>[1] : [number]
|
||||
>1 : 1
|
||||
|
||||
function f23([x = 0, y = 'bar'] = [1, 'foo']) {}
|
||||
>f23 : ([x, y]?: [number, string]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
>[1, 'foo'] : [number, string]
|
||||
>1 : 1
|
||||
>'foo' : "foo"
|
||||
|
||||
declare const nx: number | undefined;
|
||||
>nx : number | undefined
|
||||
|
||||
declare const sx: string | undefined;
|
||||
>sx : string | undefined
|
||||
|
||||
function f30([x = 0, y = 'bar']) {}
|
||||
>f30 : ([x, y]: [(number | undefined)?, (string | undefined)?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
|
||||
function f31([x = 0, y = 'bar'] = []) {}
|
||||
>f31 : ([x, y]?: [(number | undefined)?, (string | undefined)?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
>[] : []
|
||||
|
||||
function f32([x = 0, y = 'bar'] = [nx]) {}
|
||||
>f32 : ([x, y]?: [number | undefined, (string | undefined)?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
>[nx] : [number | undefined]
|
||||
>nx : number | undefined
|
||||
|
||||
function f33([x = 0, y = 'bar'] = [nx, sx]) {}
|
||||
>f33 : ([x, y]?: [number | undefined, string | undefined]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
>[nx, sx] : [number | undefined, string | undefined]
|
||||
>nx : number | undefined
|
||||
>sx : string | undefined
|
||||
|
||||
function f40([x = 0, y = 'bar']) {}
|
||||
>f40 : ([x, y]: [(number | undefined)?, (string | undefined)?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
|
||||
function f41([x = 0, y = 'bar'] = []) {}
|
||||
>f41 : ([x, y]?: [(number | undefined)?, (string | undefined)?]) => void
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
>[] : []
|
||||
|
||||
function f42([x = 0, y = 'bar'] = [sx]) {}
|
||||
>f42 : ([x, y]?: [string | undefined, (string | undefined)?]) => void
|
||||
>x : string | number
|
||||
>0 : 0
|
||||
>y : string
|
||||
>'bar' : "bar"
|
||||
>[sx] : [string | undefined]
|
||||
>sx : string | undefined
|
||||
|
||||
function f43([x = 0, y = 'bar'] = [sx, nx]) {}
|
||||
>f43 : ([x, y]?: [string | undefined, number | undefined]) => void
|
||||
>x : string | number
|
||||
>0 : 0
|
||||
>y : string | number
|
||||
>'bar' : "bar"
|
||||
>[sx, nx] : [string | undefined, number | undefined]
|
||||
>sx : string | undefined
|
||||
>nx : number | undefined
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/downlevelLetConst12.ts(6,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/downlevelLetConst12.ts(9,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/downlevelLetConst12.ts(6,6): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/compiler/downlevelLetConst12.ts(9,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/downlevelLetConst12.ts (2 errors) ====
|
||||
@@ -10,10 +10,10 @@ tests/cases/compiler/downlevelLetConst12.ts(9,8): error TS2525: Initializer prov
|
||||
|
||||
let [baz] = [];
|
||||
~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
let {a: baz2} = { a: 1 };
|
||||
|
||||
const [baz3] = []
|
||||
~~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
const {a: baz4} = { a: 1 };
|
||||
@@ -11,8 +11,8 @@ const bar = 1;
|
||||
>1 : 1
|
||||
|
||||
let [baz] = [];
|
||||
>baz : any
|
||||
>[] : [undefined?]
|
||||
>baz : undefined
|
||||
>[] : []
|
||||
|
||||
let {a: baz2} = { a: 1 };
|
||||
>a : any
|
||||
@@ -22,8 +22,8 @@ let {a: baz2} = { a: 1 };
|
||||
>1 : 1
|
||||
|
||||
const [baz3] = []
|
||||
>baz3 : any
|
||||
>[] : [undefined?]
|
||||
>baz3 : undefined
|
||||
>[] : []
|
||||
|
||||
const {a: baz4} = { a: 1 };
|
||||
>a : any
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/downlevelLetConst16.ts(151,15): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(164,17): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(151,15): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(164,17): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(195,14): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(202,15): error TS2339: Property 'a' does not exist on type 'undefined'.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(216,16): error TS2461: Type 'undefined' is not an array type.
|
||||
@@ -159,7 +159,7 @@ tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2339: Property 'a'
|
||||
}
|
||||
for (let [y] = []; ;) {
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
use(y);
|
||||
}
|
||||
for (let {a: z} = {a: 1}; ;) {
|
||||
@@ -174,7 +174,7 @@ tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2339: Property 'a'
|
||||
}
|
||||
for (const [y] = []; ;) {
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
use(y);
|
||||
}
|
||||
for (const {a: z} = { a: 1 }; ;) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user