mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'main' into release-5.0
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
{
|
||||
"name": "addReply",
|
||||
"parameters": {
|
||||
"comment": "Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, and @minestarks for you. Feel free to loop in other consumers/maintainers if necessary"
|
||||
"comment": "Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, @zkat, and @joj for you. Feel free to loop in other consumers/maintainers if necessary"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -487,7 +487,7 @@
|
||||
{
|
||||
"name": "addReply",
|
||||
"parameters": {
|
||||
"comment": "Thanks for the PR! It looks like you've changed 'preProcess.ts' in some way. Please ensure that any changes here don't break consumers with unique project systems such as Visual Studio. Pinging @sheetalkamat and @minestarks so they are aware of the changes."
|
||||
"comment": "Thanks for the PR! It looks like you've changed 'preProcess.ts' in some way. Please ensure that any changes here don't break consumers with unique project systems such as Visual Studio. Pinging @sheetalkamat, @zkat, and @joj so they are aware of the changes."
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Generated
+301
-440
File diff suppressed because it is too large
Load Diff
@@ -26,13 +26,13 @@ const parsed = minimist(process.argv.slice(2), {
|
||||
inspect: process.env.inspect || process.env["inspect-brk"] || process.env.i,
|
||||
host: process.env.TYPESCRIPT_HOST || process.env.host || "node",
|
||||
browser: process.env.browser || process.env.b || (os.platform() === "win32" ? "edge" : "chrome"),
|
||||
timeout: process.env.timeout || 40000,
|
||||
timeout: +(process.env.timeout ?? 0) || 40000,
|
||||
tests: process.env.test || process.env.tests || process.env.t,
|
||||
runners: process.env.runners || process.env.runner || process.env.ru,
|
||||
light: process.env.light === undefined || process.env.light !== "false",
|
||||
reporter: process.env.reporter || process.env.r,
|
||||
fix: process.env.fix || process.env.f,
|
||||
workers: process.env.workerCount || ((os.cpus().length - (ci ? 0 : 1)) || 1),
|
||||
workers: +(process.env.workerCount ?? 0) || ((os.cpus().length - (ci ? 0 : 1)) || 1),
|
||||
failed: false,
|
||||
keepFailed: false,
|
||||
lkg: true,
|
||||
@@ -73,11 +73,11 @@ export default options;
|
||||
* @property {string | boolean} break
|
||||
* @property {string | boolean} inspect
|
||||
* @property {string} runners
|
||||
* @property {string|number} workers
|
||||
* @property {number} workers
|
||||
* @property {string} host
|
||||
* @property {string} reporter
|
||||
* @property {string} stackTraceLimit
|
||||
* @property {string|number} timeout
|
||||
* @property {number} timeout
|
||||
* @property {boolean} failed
|
||||
* @property {boolean} keepFailed
|
||||
* @property {boolean} ci
|
||||
|
||||
@@ -175,9 +175,9 @@ export async function cleanTestDirs() {
|
||||
* @param {string} runners
|
||||
* @param {boolean} light
|
||||
* @param {string} [taskConfigsFolder]
|
||||
* @param {string | number} [workerCount]
|
||||
* @param {number} [workerCount]
|
||||
* @param {string} [stackTraceLimit]
|
||||
* @param {string | number} [timeout]
|
||||
* @param {number} [timeout]
|
||||
* @param {boolean} [keepFailed]
|
||||
* @param {number | undefined} [shards]
|
||||
* @param {number | undefined} [shardId]
|
||||
|
||||
+12
-9
@@ -111,7 +111,10 @@ import {
|
||||
createGetCanonicalFileName,
|
||||
createGetSymbolWalker,
|
||||
createModeAwareCacheKey,
|
||||
createPrinter,
|
||||
createPrinterWithDefaults,
|
||||
createPrinterWithRemoveComments,
|
||||
createPrinterWithRemoveCommentsNeverAsciiEscape,
|
||||
createPrinterWithRemoveCommentsOmitTrailingSemicolon,
|
||||
createPropertyNameNodeForIdentifierOrLiteral,
|
||||
createSymbolTable,
|
||||
createTextWriter,
|
||||
@@ -6123,7 +6126,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
function symbolToStringWorker(writer: EmitTextWriter) {
|
||||
const entity = builder(symbol, meaning!, enclosingDeclaration, nodeFlags)!; // TODO: GH#18217
|
||||
// add neverAsciiEscape for GH#39027
|
||||
const printer = enclosingDeclaration?.kind === SyntaxKind.SourceFile ? createPrinter({ removeComments: true, neverAsciiEscape: true }) : createPrinter({ removeComments: true });
|
||||
const printer = enclosingDeclaration?.kind === SyntaxKind.SourceFile
|
||||
? createPrinterWithRemoveCommentsNeverAsciiEscape()
|
||||
: createPrinterWithRemoveComments();
|
||||
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
||||
printer.writeNode(EmitHint.Unspecified, entity, /*sourceFile*/ sourceFile, writer);
|
||||
return writer;
|
||||
@@ -6142,7 +6147,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
sigOutput = kind === SignatureKind.Construct ? SyntaxKind.ConstructSignature : SyntaxKind.CallSignature;
|
||||
}
|
||||
const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.WriteTypeParametersInQualifiedName);
|
||||
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
||||
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
|
||||
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
||||
printer.writeNode(EmitHint.Unspecified, sig!, /*sourceFile*/ sourceFile, getTrailingSemicolonDeferringWriter(writer)); // TODO: GH#18217
|
||||
return writer;
|
||||
@@ -6155,8 +6160,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
if (typeNode === undefined) return Debug.fail("should always get typenode");
|
||||
// The unresolved type gets a synthesized comment on `any` to hint to users that it's not a plain `any`.
|
||||
// Otherwise, we always strip comments out.
|
||||
const options = { removeComments: type !== unresolvedType };
|
||||
const printer = createPrinter(options);
|
||||
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
||||
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
||||
printer.writeNode(EmitHint.Unspecified, typeNode, /*sourceFile*/ sourceFile, writer);
|
||||
const result = writer.getText();
|
||||
@@ -9636,7 +9640,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
typePredicate.kind === TypePredicateKind.Identifier || typePredicate.kind === TypePredicateKind.AssertsIdentifier ? factory.createIdentifier(typePredicate.parameterName) : factory.createThisTypeNode(),
|
||||
typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.WriteTypeParametersInQualifiedName)! // TODO: GH#18217
|
||||
);
|
||||
const printer = createPrinter({ removeComments: true });
|
||||
const printer = createPrinterWithRemoveComments();
|
||||
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
||||
printer.writeNode(EmitHint.Unspecified, predicate, /*sourceFile*/ sourceFile, writer);
|
||||
return writer;
|
||||
@@ -27211,7 +27215,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
isFunctionLike(node) && !getImmediatelyInvokedFunctionExpression(node) ||
|
||||
node.kind === SyntaxKind.ModuleBlock ||
|
||||
node.kind === SyntaxKind.SourceFile ||
|
||||
node.kind === SyntaxKind.CatchClause ||
|
||||
node.kind === SyntaxKind.PropertyDeclaration)!;
|
||||
}
|
||||
|
||||
@@ -27587,7 +27590,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const isParameter = getRootDeclaration(declaration).kind === SyntaxKind.Parameter;
|
||||
const declarationContainer = getControlFlowContainer(declaration);
|
||||
let flowContainer = getControlFlowContainer(node);
|
||||
const isCatch = flowContainer.kind === SyntaxKind.CatchClause;
|
||||
const isOuterVariable = flowContainer !== declarationContainer;
|
||||
const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
|
||||
const isModuleExports = symbol.flags & SymbolFlags.ModuleExports;
|
||||
@@ -27602,7 +27604,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
|
||||
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
|
||||
// declaration container are the same).
|
||||
const assumeInitialized = isParameter || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
|
||||
const assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
|
||||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (TypeFlags.AnyOrUnknown | TypeFlags.Void)) !== 0 ||
|
||||
isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === SyntaxKind.ExportSpecifier) ||
|
||||
node.parent.kind === SyntaxKind.NonNullExpression ||
|
||||
@@ -43901,6 +43903,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
|
||||
const isIllegalExportDefaultInCJS = !node.isExportEquals &&
|
||||
!(node.flags & NodeFlags.Ambient) &&
|
||||
compilerOptions.verbatimModuleSyntax &&
|
||||
(moduleKind === ModuleKind.CommonJS || getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.CommonJS);
|
||||
|
||||
|
||||
@@ -1343,6 +1343,18 @@ const enum PipelinePhase {
|
||||
Emit,
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export const createPrinterWithDefaults = memoize(() => createPrinter({}));
|
||||
|
||||
/** @internal */
|
||||
export const createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
|
||||
|
||||
/** @internal */
|
||||
export const createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
|
||||
|
||||
/** @internal */
|
||||
export const createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
|
||||
|
||||
export function createPrinter(printerOptions: PrinterOptions = {}, handlers: PrintHandlers = {}): Printer {
|
||||
const {
|
||||
hasGlobalName,
|
||||
|
||||
@@ -1279,6 +1279,20 @@ export function getScriptTargetFeatures(): ScriptTargetFeatures {
|
||||
BigUint64Array: ["at"],
|
||||
ObjectConstructor: ["hasOwn"],
|
||||
Error: ["cause"]
|
||||
},
|
||||
es2023: {
|
||||
Array: ["findLastIndex", "findLast"],
|
||||
Int8Array: ["findLastIndex", "findLast"],
|
||||
Uint8Array: ["findLastIndex", "findLast"],
|
||||
Uint8ClampedArray: ["findLastIndex", "findLast"],
|
||||
Int16Array: ["findLastIndex", "findLast"],
|
||||
Uint16Array: ["findLastIndex", "findLast"],
|
||||
Int32Array: ["findLastIndex", "findLast"],
|
||||
Uint32Array: ["findLastIndex", "findLast"],
|
||||
Float32Array: ["findLastIndex", "findLast"],
|
||||
Float64Array: ["findLastIndex", "findLast"],
|
||||
BigInt64Array: ["findLastIndex", "findLast"],
|
||||
BigUint64Array: ["findLastIndex", "findLast"],
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -727,7 +727,7 @@ export class SessionClient implements LanguageService {
|
||||
return notImplemented();
|
||||
}
|
||||
|
||||
getDocCommentTemplateAtPosition(_fileName: string, _position: number, _options?: DocCommentTemplateOptions): TextInsertion {
|
||||
getDocCommentTemplateAtPosition(_fileName: string, _position: number, _options?: DocCommentTemplateOptions, _formatOptions?: FormatCodeSettings): TextInsertion {
|
||||
return notImplemented();
|
||||
}
|
||||
|
||||
|
||||
@@ -3249,7 +3249,7 @@ export class TestState {
|
||||
|
||||
public verifyDocCommentTemplate(expected: ts.TextInsertion | undefined, options?: ts.DocCommentTemplateOptions) {
|
||||
const name = "verifyDocCommentTemplate";
|
||||
const actual = this.languageService.getDocCommentTemplateAtPosition(this.activeFile.fileName, this.currentCaretPosition, options || { generateReturnInDocTemplate: true })!;
|
||||
const actual = this.languageService.getDocCommentTemplateAtPosition(this.activeFile.fileName, this.currentCaretPosition, options || { generateReturnInDocTemplate: true }, this.formatCodeSettings)!;
|
||||
|
||||
if (expected === undefined) {
|
||||
if (actual) {
|
||||
|
||||
@@ -452,7 +452,7 @@ export class Verify extends VerifyNegatable {
|
||||
|
||||
public docCommentTemplateAt(marker: string | FourSlash.Marker, expectedOffset: number, expectedText: string, options?: ts.DocCommentTemplateOptions) {
|
||||
this.state.goToMarker(marker);
|
||||
this.state.verifyDocCommentTemplate({ newText: expectedText.replace(/\r?\n/g, "\r\n"), caretOffset: expectedOffset }, options);
|
||||
this.state.verifyDocCommentTemplate({ newText: expectedText.replace(/\r?\n/g, ts.testFormatSettings.newLineCharacter!), caretOffset: expectedOffset }, options);
|
||||
}
|
||||
|
||||
public noDocCommentTemplateAt(marker: string | FourSlash.Marker) {
|
||||
|
||||
@@ -587,8 +587,8 @@ class LanguageServiceShimProxy implements ts.LanguageService {
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: ts.FormatCodeOptions): ts.TextChange[] {
|
||||
return unwrapJSONCallResult(this.shim.getFormattingEditsAfterKeystroke(fileName, position, key, JSON.stringify(options)));
|
||||
}
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: ts.DocCommentTemplateOptions): ts.TextInsertion {
|
||||
return unwrapJSONCallResult(this.shim.getDocCommentTemplateAtPosition(fileName, position, options));
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: ts.DocCommentTemplateOptions, formatOptions?: ts.FormatCodeSettings): ts.TextInsertion {
|
||||
return unwrapJSONCallResult(this.shim.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions));
|
||||
}
|
||||
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean {
|
||||
return unwrapJSONCallResult(this.shim.isValidBraceCompletionAtPosition(fileName, position, openingBrace));
|
||||
|
||||
@@ -2083,7 +2083,7 @@ export class Session<TMessage = string> implements EventSender {
|
||||
private getDocCommentTemplate(args: protocol.FileLocationRequestArgs) {
|
||||
const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
|
||||
const position = this.getPositionInFile(args, file);
|
||||
return languageService.getDocCommentTemplateAtPosition(file, position, this.getPreferences(file));
|
||||
return languageService.getDocCommentTemplateAtPosition(file, position, this.getPreferences(file), this.getFormatOptions(file));
|
||||
}
|
||||
|
||||
private getSpanOfEnclosingComment(args: protocol.SpanOfEnclosingCommentRequestArgs) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
ClassLikeDeclaration,
|
||||
ClassStaticBlockDeclaration,
|
||||
compareStringsCaseSensitive,
|
||||
createPrinter,
|
||||
createPrinterWithRemoveCommentsOmitTrailingSemicolon,
|
||||
createTextRangeFromNode,
|
||||
createTextSpanFromBounds,
|
||||
createTextSpanFromRange,
|
||||
@@ -245,7 +245,7 @@ function getCallHierarchyItemName(program: Program, node: CallHierarchyDeclarati
|
||||
}
|
||||
if (text === undefined) {
|
||||
// get the text from printing the node on a single line without comments...
|
||||
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
||||
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
|
||||
text = usingSingleLineStringWriter(writer => printer.writeNode(EmitHint.Unspecified, node, node.getSourceFile(), writer));
|
||||
}
|
||||
return { text, pos: declName.getStart(), end: declName.getEnd() };
|
||||
|
||||
@@ -83,7 +83,7 @@ function getDeleteAction(context: CodeFixContext, { name, jsDocHost, jsDocParame
|
||||
);
|
||||
}
|
||||
|
||||
function getRenameAction(context: CodeFixContext, { name, signature, jsDocParameterTag }: Info) {
|
||||
function getRenameAction(context: CodeFixContext, { name, jsDocHost, signature, jsDocParameterTag }: Info) {
|
||||
if (!length(signature.parameters)) return undefined;
|
||||
|
||||
const sourceFile = context.sourceFile;
|
||||
@@ -110,7 +110,7 @@ function getRenameAction(context: CodeFixContext, { name, signature, jsDocParame
|
||||
jsDocParameterTag.comment
|
||||
);
|
||||
const changes = textChanges.ChangeTracker.with(context, changeTracker =>
|
||||
changeTracker.replaceJSDocComment(sourceFile, signature, map(tags, t => t === jsDocParameterTag ? newJSDocParameterTag : t)));
|
||||
changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, t => t === jsDocParameterTag ? newJSDocParameterTag : t)));
|
||||
return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
__String,
|
||||
ArrowFunction,
|
||||
CallExpression,
|
||||
createPrinter,
|
||||
createPrinterWithRemoveComments,
|
||||
Debug,
|
||||
EmitHint,
|
||||
EnumMember,
|
||||
@@ -53,7 +53,6 @@ import {
|
||||
NodeBuilderFlags,
|
||||
ParameterDeclaration,
|
||||
PrefixUnaryExpression,
|
||||
PrinterOptions,
|
||||
PropertyDeclaration,
|
||||
Signature,
|
||||
skipParentheses,
|
||||
@@ -383,8 +382,7 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
|
||||
|
||||
function printTypeInSingleLine(type: Type) {
|
||||
const flags = NodeBuilderFlags.IgnoreErrors | TypeFormatFlags.AllowUniqueESSymbolType | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
|
||||
const options: PrinterOptions = { removeComments: true };
|
||||
const printer = createPrinter(options);
|
||||
const printer = createPrinterWithRemoveComments();
|
||||
|
||||
return usingSingleLineStringWriter(writer => {
|
||||
const typeNode = checker.typeToTypeNode(type, /*enclosingDeclaration*/ undefined, flags);
|
||||
|
||||
@@ -135,6 +135,8 @@ const jsDocTagNames = [
|
||||
"lends",
|
||||
"license",
|
||||
"link",
|
||||
"linkcode",
|
||||
"linkplain",
|
||||
"listens",
|
||||
"member",
|
||||
"memberof",
|
||||
@@ -147,6 +149,7 @@ const jsDocTagNames = [
|
||||
"package",
|
||||
"param",
|
||||
"private",
|
||||
"prop",
|
||||
"property",
|
||||
"protected",
|
||||
"public",
|
||||
|
||||
@@ -2436,8 +2436,9 @@ export function createLanguageService(
|
||||
: Promise.reject("Host does not implement `installPackage`");
|
||||
}
|
||||
|
||||
function getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): TextInsertion | undefined {
|
||||
return JsDoc.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host, /*formatSettings*/ undefined), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
|
||||
function getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): TextInsertion | undefined {
|
||||
const formatSettings = formatOptions ? formatting.getFormatContext(formatOptions, host).options : undefined;
|
||||
return JsDoc.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host, formatSettings), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
|
||||
}
|
||||
|
||||
function isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean {
|
||||
|
||||
@@ -349,7 +349,7 @@ export interface LanguageServiceShim extends Shim {
|
||||
/**
|
||||
* Returns JSON-encoded value of the type TextInsertion.
|
||||
*/
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): string;
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): string;
|
||||
|
||||
/**
|
||||
* Returns JSON-encoded boolean to indicate whether we should support brace location
|
||||
@@ -1091,10 +1091,10 @@ class LanguageServiceShimObject extends ShimBase implements LanguageServiceShim
|
||||
});
|
||||
}
|
||||
|
||||
public getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): string {
|
||||
public getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): string {
|
||||
return this.forwardJSONCall(
|
||||
`getDocCommentTemplateAtPosition('${fileName}', ${position})`,
|
||||
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options)
|
||||
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
CheckFlags,
|
||||
contains,
|
||||
countWhere,
|
||||
createPrinter,
|
||||
createPrinterWithRemoveComments,
|
||||
createTextSpan,
|
||||
createTextSpanFromBounds,
|
||||
createTextSpanFromNode,
|
||||
@@ -659,7 +659,7 @@ function createTypeHelpItems(
|
||||
function getTypeHelpItem(symbol: Symbol, typeParameters: readonly TypeParameter[], checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItem {
|
||||
const typeSymbolDisplay = symbolToDisplayParts(checker, symbol);
|
||||
|
||||
const printer = createPrinter({ removeComments: true });
|
||||
const printer = createPrinterWithRemoveComments();
|
||||
const parameters = typeParameters.map(t => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
|
||||
|
||||
const documentation = symbol.getDocumentationComment(checker);
|
||||
@@ -699,7 +699,7 @@ interface SignatureHelpItemInfo { readonly isVariadic: boolean; readonly paramet
|
||||
|
||||
function itemInfoForTypeParameters(candidateSignature: Signature, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItemInfo[] {
|
||||
const typeParameters = (candidateSignature.target || candidateSignature).typeParameters;
|
||||
const printer = createPrinter({ removeComments: true });
|
||||
const printer = createPrinterWithRemoveComments();
|
||||
const parameters = (typeParameters || emptyArray).map(t => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
|
||||
const thisParameter = candidateSignature.thisParameter ? [checker.symbolToParameterDeclaration(candidateSignature.thisParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)!] : [];
|
||||
|
||||
@@ -713,7 +713,7 @@ function itemInfoForTypeParameters(candidateSignature: Signature, checker: TypeC
|
||||
}
|
||||
|
||||
function itemInfoForParameters(candidateSignature: Signature, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItemInfo[] {
|
||||
const printer = createPrinter({ removeComments: true });
|
||||
const printer = createPrinterWithRemoveComments();
|
||||
const typeParameterParts = mapToDisplayParts(writer => {
|
||||
if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) {
|
||||
const args = factory.createNodeArray(candidateSignature.typeParameters.map(p => checker.typeParameterToDeclaration(p, enclosingDeclaration, signatureHelpNodeBuilderFlags)!));
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
CallExpression,
|
||||
CheckFlags,
|
||||
contains,
|
||||
createPrinter,
|
||||
createPrinterWithRemoveComments,
|
||||
Debug,
|
||||
displayPart,
|
||||
EmitHint,
|
||||
@@ -75,7 +75,6 @@ import {
|
||||
NodeBuilderFlags,
|
||||
ObjectFlags,
|
||||
operatorPart,
|
||||
Printer,
|
||||
PropertyAccessExpression,
|
||||
PropertyDeclaration,
|
||||
punctuationPart,
|
||||
@@ -259,7 +258,6 @@ export function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker: Typ
|
||||
let hasAddedSymbolInfo = false;
|
||||
const isThisExpression = location.kind === SyntaxKind.ThisKeyword && isInExpressionContext(location) || isThisInTypeQuery(location);
|
||||
let type: Type | undefined;
|
||||
let printer: Printer;
|
||||
let documentationFromAlias: SymbolDisplayPart[] | undefined;
|
||||
let tagsFromAlias: JSDocTagInfo[] | undefined;
|
||||
let hasMultipleSignatures = false;
|
||||
@@ -730,10 +728,7 @@ export function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker: Typ
|
||||
return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? undefined : tags };
|
||||
|
||||
function getPrinter() {
|
||||
if (!printer) {
|
||||
printer = createPrinter({ removeComments: true });
|
||||
}
|
||||
return printer;
|
||||
return createPrinterWithRemoveComments();
|
||||
}
|
||||
|
||||
function prefixNextMeaning() {
|
||||
|
||||
@@ -604,7 +604,7 @@ export interface LanguageService {
|
||||
getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
|
||||
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): TextInsertion | undefined;
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): TextInsertion | undefined;
|
||||
|
||||
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
ConditionalExpression,
|
||||
contains,
|
||||
ContextFlags,
|
||||
createPrinter,
|
||||
createPrinterWithRemoveCommentsOmitTrailingSemicolon,
|
||||
createRange,
|
||||
createScanner,
|
||||
createTextSpan,
|
||||
@@ -2984,7 +2984,7 @@ export function signatureToDisplayParts(typechecker: TypeChecker, signature: Sig
|
||||
export function nodeToDisplayParts(node: Node, enclosingDeclaration: Node): SymbolDisplayPart[] {
|
||||
const file = enclosingDeclaration.getSourceFile();
|
||||
return mapToDisplayParts(writer => {
|
||||
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
||||
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
|
||||
printer.writeNode(EmitHint.Unspecified, node, file, writer);
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -9990,7 +9990,7 @@ declare namespace ts {
|
||||
getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
|
||||
getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): TextInsertion | undefined;
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): TextInsertion | undefined;
|
||||
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
|
||||
/**
|
||||
* This will return a defined result if the position is after the `>` of the opening tag, or somewhere in the text, of a JSXElement with no closing tag.
|
||||
|
||||
+1
-1
@@ -6088,7 +6088,7 @@ declare namespace ts {
|
||||
getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
|
||||
getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): TextInsertion | undefined;
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): TextInsertion | undefined;
|
||||
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
|
||||
/**
|
||||
* This will return a defined result if the position is after the `>` of the opening tag, or somewhere in the text, of a JSXElement with no closing tag.
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
tests/cases/compiler/findLast.ts(1,44): error TS2550: Property 'findLast' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(2,51): error TS2550: Property 'findLast' does not exist on type 'string[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(3,17): error TS2550: Property 'findLast' does not exist on type 'Int8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(4,18): error TS2550: Property 'findLast' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(5,25): error TS2550: Property 'findLast' does not exist on type 'Uint8ClampedArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(6,18): error TS2550: Property 'findLast' does not exist on type 'Int16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(7,19): error TS2550: Property 'findLast' does not exist on type 'Uint16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(8,18): error TS2550: Property 'findLast' does not exist on type 'Int32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(9,19): error TS2550: Property 'findLast' does not exist on type 'Uint32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(10,20): error TS2550: Property 'findLast' does not exist on type 'Float32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(11,20): error TS2550: Property 'findLast' does not exist on type 'Float64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(12,21): error TS2550: Property 'findLast' does not exist on type 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(13,22): error TS2550: Property 'findLast' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(15,33): error TS2550: Property 'findLastIndex' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(16,40): error TS2550: Property 'findLastIndex' does not exist on type 'string[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(17,17): error TS2550: Property 'findLastIndex' does not exist on type 'Int8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(18,18): error TS2550: Property 'findLastIndex' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(19,25): error TS2550: Property 'findLastIndex' does not exist on type 'Uint8ClampedArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(20,18): error TS2550: Property 'findLastIndex' does not exist on type 'Int16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(21,19): error TS2550: Property 'findLastIndex' does not exist on type 'Uint16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(22,18): error TS2550: Property 'findLastIndex' does not exist on type 'Int32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(23,19): error TS2550: Property 'findLastIndex' does not exist on type 'Uint32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(24,20): error TS2550: Property 'findLastIndex' does not exist on type 'Float32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(25,20): error TS2550: Property 'findLastIndex' does not exist on type 'Float64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(26,21): error TS2550: Property 'findLastIndex' does not exist on type 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
tests/cases/compiler/findLast.ts(27,22): error TS2550: Property 'findLastIndex' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
|
||||
|
||||
==== tests/cases/compiler/findLast.ts (26 errors) ====
|
||||
const itemNumber: number | undefined = [0].findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
const itemString: string | undefined = ["string"].findLast((item) => item === "string");
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'string[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Int8Array().findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'Int8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Uint8Array().findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Uint8ClampedArray().findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'Uint8ClampedArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Int16Array().findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'Int16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Uint16Array().findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'Uint16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Int32Array().findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'Int32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Uint32Array().findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'Uint32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Float32Array().findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'Float32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Float64Array().findLast((item) => item === 0);
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'Float64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new BigInt64Array().findLast((item) => item === BigInt(0));
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new BigUint64Array().findLast((item) => item === BigInt(0));
|
||||
~~~~~~~~
|
||||
!!! error TS2550: Property 'findLast' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
|
||||
const indexNumber: number = [0].findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
const indexString: number = ["string"].findLastIndex((item) => item === "string");
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'string[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Int8Array().findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'Int8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Uint8Array().findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Uint8ClampedArray().findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'Uint8ClampedArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Int16Array().findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'Int16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Uint16Array().findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'Uint16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Int32Array().findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'Int32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Uint32Array().findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'Uint32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Float32Array().findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'Float32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new Float64Array().findLastIndex((item) => item === 0);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'Float64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new BigInt64Array().findLastIndex((item) => item === BigInt(0));
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
new BigUint64Array().findLastIndex((item) => item === BigInt(0));
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//// [findLast.ts]
|
||||
const itemNumber: number | undefined = [0].findLast((item) => item === 0);
|
||||
const itemString: string | undefined = ["string"].findLast((item) => item === "string");
|
||||
new Int8Array().findLast((item) => item === 0);
|
||||
new Uint8Array().findLast((item) => item === 0);
|
||||
new Uint8ClampedArray().findLast((item) => item === 0);
|
||||
new Int16Array().findLast((item) => item === 0);
|
||||
new Uint16Array().findLast((item) => item === 0);
|
||||
new Int32Array().findLast((item) => item === 0);
|
||||
new Uint32Array().findLast((item) => item === 0);
|
||||
new Float32Array().findLast((item) => item === 0);
|
||||
new Float64Array().findLast((item) => item === 0);
|
||||
new BigInt64Array().findLast((item) => item === BigInt(0));
|
||||
new BigUint64Array().findLast((item) => item === BigInt(0));
|
||||
|
||||
const indexNumber: number = [0].findLastIndex((item) => item === 0);
|
||||
const indexString: number = ["string"].findLastIndex((item) => item === "string");
|
||||
new Int8Array().findLastIndex((item) => item === 0);
|
||||
new Uint8Array().findLastIndex((item) => item === 0);
|
||||
new Uint8ClampedArray().findLastIndex((item) => item === 0);
|
||||
new Int16Array().findLastIndex((item) => item === 0);
|
||||
new Uint16Array().findLastIndex((item) => item === 0);
|
||||
new Int32Array().findLastIndex((item) => item === 0);
|
||||
new Uint32Array().findLastIndex((item) => item === 0);
|
||||
new Float32Array().findLastIndex((item) => item === 0);
|
||||
new Float64Array().findLastIndex((item) => item === 0);
|
||||
new BigInt64Array().findLastIndex((item) => item === BigInt(0));
|
||||
new BigUint64Array().findLastIndex((item) => item === BigInt(0));
|
||||
|
||||
|
||||
//// [findLast.js]
|
||||
const itemNumber = [0].findLast((item) => item === 0);
|
||||
const itemString = ["string"].findLast((item) => item === "string");
|
||||
new Int8Array().findLast((item) => item === 0);
|
||||
new Uint8Array().findLast((item) => item === 0);
|
||||
new Uint8ClampedArray().findLast((item) => item === 0);
|
||||
new Int16Array().findLast((item) => item === 0);
|
||||
new Uint16Array().findLast((item) => item === 0);
|
||||
new Int32Array().findLast((item) => item === 0);
|
||||
new Uint32Array().findLast((item) => item === 0);
|
||||
new Float32Array().findLast((item) => item === 0);
|
||||
new Float64Array().findLast((item) => item === 0);
|
||||
new BigInt64Array().findLast((item) => item === BigInt(0));
|
||||
new BigUint64Array().findLast((item) => item === BigInt(0));
|
||||
const indexNumber = [0].findLastIndex((item) => item === 0);
|
||||
const indexString = ["string"].findLastIndex((item) => item === "string");
|
||||
new Int8Array().findLastIndex((item) => item === 0);
|
||||
new Uint8Array().findLastIndex((item) => item === 0);
|
||||
new Uint8ClampedArray().findLastIndex((item) => item === 0);
|
||||
new Int16Array().findLastIndex((item) => item === 0);
|
||||
new Uint16Array().findLastIndex((item) => item === 0);
|
||||
new Int32Array().findLastIndex((item) => item === 0);
|
||||
new Uint32Array().findLastIndex((item) => item === 0);
|
||||
new Float32Array().findLastIndex((item) => item === 0);
|
||||
new Float64Array().findLastIndex((item) => item === 0);
|
||||
new BigInt64Array().findLastIndex((item) => item === BigInt(0));
|
||||
new BigUint64Array().findLastIndex((item) => item === BigInt(0));
|
||||
@@ -0,0 +1,135 @@
|
||||
=== tests/cases/compiler/findLast.ts ===
|
||||
const itemNumber: number | undefined = [0].findLast((item) => item === 0);
|
||||
>itemNumber : Symbol(itemNumber, Decl(findLast.ts, 0, 5))
|
||||
>item : Symbol(item, Decl(findLast.ts, 0, 53))
|
||||
>item : Symbol(item, Decl(findLast.ts, 0, 53))
|
||||
|
||||
const itemString: string | undefined = ["string"].findLast((item) => item === "string");
|
||||
>itemString : Symbol(itemString, Decl(findLast.ts, 1, 5))
|
||||
>item : Symbol(item, Decl(findLast.ts, 1, 60))
|
||||
>item : Symbol(item, Decl(findLast.ts, 1, 60))
|
||||
|
||||
new Int8Array().findLast((item) => item === 0);
|
||||
>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 2, 26))
|
||||
>item : Symbol(item, Decl(findLast.ts, 2, 26))
|
||||
|
||||
new Uint8Array().findLast((item) => item === 0);
|
||||
>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 3, 27))
|
||||
>item : Symbol(item, Decl(findLast.ts, 3, 27))
|
||||
|
||||
new Uint8ClampedArray().findLast((item) => item === 0);
|
||||
>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 4, 34))
|
||||
>item : Symbol(item, Decl(findLast.ts, 4, 34))
|
||||
|
||||
new Int16Array().findLast((item) => item === 0);
|
||||
>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 5, 27))
|
||||
>item : Symbol(item, Decl(findLast.ts, 5, 27))
|
||||
|
||||
new Uint16Array().findLast((item) => item === 0);
|
||||
>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 6, 28))
|
||||
>item : Symbol(item, Decl(findLast.ts, 6, 28))
|
||||
|
||||
new Int32Array().findLast((item) => item === 0);
|
||||
>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 7, 27))
|
||||
>item : Symbol(item, Decl(findLast.ts, 7, 27))
|
||||
|
||||
new Uint32Array().findLast((item) => item === 0);
|
||||
>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 8, 28))
|
||||
>item : Symbol(item, Decl(findLast.ts, 8, 28))
|
||||
|
||||
new Float32Array().findLast((item) => item === 0);
|
||||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 9, 29))
|
||||
>item : Symbol(item, Decl(findLast.ts, 9, 29))
|
||||
|
||||
new Float64Array().findLast((item) => item === 0);
|
||||
>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 10, 29))
|
||||
>item : Symbol(item, Decl(findLast.ts, 10, 29))
|
||||
|
||||
new BigInt64Array().findLast((item) => item === BigInt(0));
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 11, 30))
|
||||
>item : Symbol(item, Decl(findLast.ts, 11, 30))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
new BigUint64Array().findLast((item) => item === BigInt(0));
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 12, 31))
|
||||
>item : Symbol(item, Decl(findLast.ts, 12, 31))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
const indexNumber: number = [0].findLastIndex((item) => item === 0);
|
||||
>indexNumber : Symbol(indexNumber, Decl(findLast.ts, 14, 5))
|
||||
>item : Symbol(item, Decl(findLast.ts, 14, 47))
|
||||
>item : Symbol(item, Decl(findLast.ts, 14, 47))
|
||||
|
||||
const indexString: number = ["string"].findLastIndex((item) => item === "string");
|
||||
>indexString : Symbol(indexString, Decl(findLast.ts, 15, 5))
|
||||
>item : Symbol(item, Decl(findLast.ts, 15, 54))
|
||||
>item : Symbol(item, Decl(findLast.ts, 15, 54))
|
||||
|
||||
new Int8Array().findLastIndex((item) => item === 0);
|
||||
>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 16, 31))
|
||||
>item : Symbol(item, Decl(findLast.ts, 16, 31))
|
||||
|
||||
new Uint8Array().findLastIndex((item) => item === 0);
|
||||
>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 17, 32))
|
||||
>item : Symbol(item, Decl(findLast.ts, 17, 32))
|
||||
|
||||
new Uint8ClampedArray().findLastIndex((item) => item === 0);
|
||||
>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 18, 39))
|
||||
>item : Symbol(item, Decl(findLast.ts, 18, 39))
|
||||
|
||||
new Int16Array().findLastIndex((item) => item === 0);
|
||||
>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 19, 32))
|
||||
>item : Symbol(item, Decl(findLast.ts, 19, 32))
|
||||
|
||||
new Uint16Array().findLastIndex((item) => item === 0);
|
||||
>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 20, 33))
|
||||
>item : Symbol(item, Decl(findLast.ts, 20, 33))
|
||||
|
||||
new Int32Array().findLastIndex((item) => item === 0);
|
||||
>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 21, 32))
|
||||
>item : Symbol(item, Decl(findLast.ts, 21, 32))
|
||||
|
||||
new Uint32Array().findLastIndex((item) => item === 0);
|
||||
>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 22, 33))
|
||||
>item : Symbol(item, Decl(findLast.ts, 22, 33))
|
||||
|
||||
new Float32Array().findLastIndex((item) => item === 0);
|
||||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 23, 34))
|
||||
>item : Symbol(item, Decl(findLast.ts, 23, 34))
|
||||
|
||||
new Float64Array().findLastIndex((item) => item === 0);
|
||||
>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
|
||||
>item : Symbol(item, Decl(findLast.ts, 24, 34))
|
||||
>item : Symbol(item, Decl(findLast.ts, 24, 34))
|
||||
|
||||
new BigInt64Array().findLastIndex((item) => item === BigInt(0));
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 25, 35))
|
||||
>item : Symbol(item, Decl(findLast.ts, 25, 35))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
new BigUint64Array().findLastIndex((item) => item === BigInt(0));
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 26, 36))
|
||||
>item : Symbol(item, Decl(findLast.ts, 26, 36))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
=== tests/cases/compiler/findLast.ts ===
|
||||
const itemNumber: number | undefined = [0].findLast((item) => item === 0);
|
||||
>itemNumber : number
|
||||
>[0].findLast((item) => item === 0) : any
|
||||
>[0].findLast : any
|
||||
>[0] : number[]
|
||||
>0 : 0
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
const itemString: string | undefined = ["string"].findLast((item) => item === "string");
|
||||
>itemString : string
|
||||
>["string"].findLast((item) => item === "string") : any
|
||||
>["string"].findLast : any
|
||||
>["string"] : string[]
|
||||
>"string" : "string"
|
||||
>findLast : any
|
||||
>(item) => item === "string" : (item: any) => boolean
|
||||
>item : any
|
||||
>item === "string" : boolean
|
||||
>item : any
|
||||
>"string" : "string"
|
||||
|
||||
new Int8Array().findLast((item) => item === 0);
|
||||
>new Int8Array().findLast((item) => item === 0) : any
|
||||
>new Int8Array().findLast : any
|
||||
>new Int8Array() : Int8Array
|
||||
>Int8Array : Int8ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Uint8Array().findLast((item) => item === 0);
|
||||
>new Uint8Array().findLast((item) => item === 0) : any
|
||||
>new Uint8Array().findLast : any
|
||||
>new Uint8Array() : Uint8Array
|
||||
>Uint8Array : Uint8ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Uint8ClampedArray().findLast((item) => item === 0);
|
||||
>new Uint8ClampedArray().findLast((item) => item === 0) : any
|
||||
>new Uint8ClampedArray().findLast : any
|
||||
>new Uint8ClampedArray() : Uint8ClampedArray
|
||||
>Uint8ClampedArray : Uint8ClampedArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Int16Array().findLast((item) => item === 0);
|
||||
>new Int16Array().findLast((item) => item === 0) : any
|
||||
>new Int16Array().findLast : any
|
||||
>new Int16Array() : Int16Array
|
||||
>Int16Array : Int16ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Uint16Array().findLast((item) => item === 0);
|
||||
>new Uint16Array().findLast((item) => item === 0) : any
|
||||
>new Uint16Array().findLast : any
|
||||
>new Uint16Array() : Uint16Array
|
||||
>Uint16Array : Uint16ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Int32Array().findLast((item) => item === 0);
|
||||
>new Int32Array().findLast((item) => item === 0) : any
|
||||
>new Int32Array().findLast : any
|
||||
>new Int32Array() : Int32Array
|
||||
>Int32Array : Int32ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Uint32Array().findLast((item) => item === 0);
|
||||
>new Uint32Array().findLast((item) => item === 0) : any
|
||||
>new Uint32Array().findLast : any
|
||||
>new Uint32Array() : Uint32Array
|
||||
>Uint32Array : Uint32ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Float32Array().findLast((item) => item === 0);
|
||||
>new Float32Array().findLast((item) => item === 0) : any
|
||||
>new Float32Array().findLast : any
|
||||
>new Float32Array() : Float32Array
|
||||
>Float32Array : Float32ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Float64Array().findLast((item) => item === 0);
|
||||
>new Float64Array().findLast((item) => item === 0) : any
|
||||
>new Float64Array().findLast : any
|
||||
>new Float64Array() : Float64Array
|
||||
>Float64Array : Float64ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new BigInt64Array().findLast((item) => item === BigInt(0));
|
||||
>new BigInt64Array().findLast((item) => item === BigInt(0)) : any
|
||||
>new BigInt64Array().findLast : any
|
||||
>new BigInt64Array() : BigInt64Array
|
||||
>BigInt64Array : BigInt64ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === BigInt(0) : (item: any) => boolean
|
||||
>item : any
|
||||
>item === BigInt(0) : boolean
|
||||
>item : any
|
||||
>BigInt(0) : bigint
|
||||
>BigInt : BigIntConstructor
|
||||
>0 : 0
|
||||
|
||||
new BigUint64Array().findLast((item) => item === BigInt(0));
|
||||
>new BigUint64Array().findLast((item) => item === BigInt(0)) : any
|
||||
>new BigUint64Array().findLast : any
|
||||
>new BigUint64Array() : BigUint64Array
|
||||
>BigUint64Array : BigUint64ArrayConstructor
|
||||
>findLast : any
|
||||
>(item) => item === BigInt(0) : (item: any) => boolean
|
||||
>item : any
|
||||
>item === BigInt(0) : boolean
|
||||
>item : any
|
||||
>BigInt(0) : bigint
|
||||
>BigInt : BigIntConstructor
|
||||
>0 : 0
|
||||
|
||||
const indexNumber: number = [0].findLastIndex((item) => item === 0);
|
||||
>indexNumber : number
|
||||
>[0].findLastIndex((item) => item === 0) : any
|
||||
>[0].findLastIndex : any
|
||||
>[0] : number[]
|
||||
>0 : 0
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
const indexString: number = ["string"].findLastIndex((item) => item === "string");
|
||||
>indexString : number
|
||||
>["string"].findLastIndex((item) => item === "string") : any
|
||||
>["string"].findLastIndex : any
|
||||
>["string"] : string[]
|
||||
>"string" : "string"
|
||||
>findLastIndex : any
|
||||
>(item) => item === "string" : (item: any) => boolean
|
||||
>item : any
|
||||
>item === "string" : boolean
|
||||
>item : any
|
||||
>"string" : "string"
|
||||
|
||||
new Int8Array().findLastIndex((item) => item === 0);
|
||||
>new Int8Array().findLastIndex((item) => item === 0) : any
|
||||
>new Int8Array().findLastIndex : any
|
||||
>new Int8Array() : Int8Array
|
||||
>Int8Array : Int8ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Uint8Array().findLastIndex((item) => item === 0);
|
||||
>new Uint8Array().findLastIndex((item) => item === 0) : any
|
||||
>new Uint8Array().findLastIndex : any
|
||||
>new Uint8Array() : Uint8Array
|
||||
>Uint8Array : Uint8ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Uint8ClampedArray().findLastIndex((item) => item === 0);
|
||||
>new Uint8ClampedArray().findLastIndex((item) => item === 0) : any
|
||||
>new Uint8ClampedArray().findLastIndex : any
|
||||
>new Uint8ClampedArray() : Uint8ClampedArray
|
||||
>Uint8ClampedArray : Uint8ClampedArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Int16Array().findLastIndex((item) => item === 0);
|
||||
>new Int16Array().findLastIndex((item) => item === 0) : any
|
||||
>new Int16Array().findLastIndex : any
|
||||
>new Int16Array() : Int16Array
|
||||
>Int16Array : Int16ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Uint16Array().findLastIndex((item) => item === 0);
|
||||
>new Uint16Array().findLastIndex((item) => item === 0) : any
|
||||
>new Uint16Array().findLastIndex : any
|
||||
>new Uint16Array() : Uint16Array
|
||||
>Uint16Array : Uint16ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Int32Array().findLastIndex((item) => item === 0);
|
||||
>new Int32Array().findLastIndex((item) => item === 0) : any
|
||||
>new Int32Array().findLastIndex : any
|
||||
>new Int32Array() : Int32Array
|
||||
>Int32Array : Int32ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Uint32Array().findLastIndex((item) => item === 0);
|
||||
>new Uint32Array().findLastIndex((item) => item === 0) : any
|
||||
>new Uint32Array().findLastIndex : any
|
||||
>new Uint32Array() : Uint32Array
|
||||
>Uint32Array : Uint32ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Float32Array().findLastIndex((item) => item === 0);
|
||||
>new Float32Array().findLastIndex((item) => item === 0) : any
|
||||
>new Float32Array().findLastIndex : any
|
||||
>new Float32Array() : Float32Array
|
||||
>Float32Array : Float32ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new Float64Array().findLastIndex((item) => item === 0);
|
||||
>new Float64Array().findLastIndex((item) => item === 0) : any
|
||||
>new Float64Array().findLastIndex : any
|
||||
>new Float64Array() : Float64Array
|
||||
>Float64Array : Float64ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === 0 : (item: any) => boolean
|
||||
>item : any
|
||||
>item === 0 : boolean
|
||||
>item : any
|
||||
>0 : 0
|
||||
|
||||
new BigInt64Array().findLastIndex((item) => item === BigInt(0));
|
||||
>new BigInt64Array().findLastIndex((item) => item === BigInt(0)) : any
|
||||
>new BigInt64Array().findLastIndex : any
|
||||
>new BigInt64Array() : BigInt64Array
|
||||
>BigInt64Array : BigInt64ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === BigInt(0) : (item: any) => boolean
|
||||
>item : any
|
||||
>item === BigInt(0) : boolean
|
||||
>item : any
|
||||
>BigInt(0) : bigint
|
||||
>BigInt : BigIntConstructor
|
||||
>0 : 0
|
||||
|
||||
new BigUint64Array().findLastIndex((item) => item === BigInt(0));
|
||||
>new BigUint64Array().findLastIndex((item) => item === BigInt(0)) : any
|
||||
>new BigUint64Array().findLastIndex : any
|
||||
>new BigUint64Array() : BigUint64Array
|
||||
>BigUint64Array : BigUint64ArrayConstructor
|
||||
>findLastIndex : any
|
||||
>(item) => item === BigInt(0) : (item: any) => boolean
|
||||
>item : any
|
||||
>item === BigInt(0) : boolean
|
||||
>item : any
|
||||
>BigInt(0) : bigint
|
||||
>BigInt : BigIntConstructor
|
||||
>0 : 0
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//// [findLast.ts]
|
||||
const itemNumber: number | undefined = [0].findLast((item) => item === 0);
|
||||
const itemString: string | undefined = ["string"].findLast((item) => item === "string");
|
||||
new Int8Array().findLast((item) => item === 0);
|
||||
new Uint8Array().findLast((item) => item === 0);
|
||||
new Uint8ClampedArray().findLast((item) => item === 0);
|
||||
new Int16Array().findLast((item) => item === 0);
|
||||
new Uint16Array().findLast((item) => item === 0);
|
||||
new Int32Array().findLast((item) => item === 0);
|
||||
new Uint32Array().findLast((item) => item === 0);
|
||||
new Float32Array().findLast((item) => item === 0);
|
||||
new Float64Array().findLast((item) => item === 0);
|
||||
new BigInt64Array().findLast((item) => item === BigInt(0));
|
||||
new BigUint64Array().findLast((item) => item === BigInt(0));
|
||||
|
||||
const indexNumber: number = [0].findLastIndex((item) => item === 0);
|
||||
const indexString: number = ["string"].findLastIndex((item) => item === "string");
|
||||
new Int8Array().findLastIndex((item) => item === 0);
|
||||
new Uint8Array().findLastIndex((item) => item === 0);
|
||||
new Uint8ClampedArray().findLastIndex((item) => item === 0);
|
||||
new Int16Array().findLastIndex((item) => item === 0);
|
||||
new Uint16Array().findLastIndex((item) => item === 0);
|
||||
new Int32Array().findLastIndex((item) => item === 0);
|
||||
new Uint32Array().findLastIndex((item) => item === 0);
|
||||
new Float32Array().findLastIndex((item) => item === 0);
|
||||
new Float64Array().findLastIndex((item) => item === 0);
|
||||
new BigInt64Array().findLastIndex((item) => item === BigInt(0));
|
||||
new BigUint64Array().findLastIndex((item) => item === BigInt(0));
|
||||
|
||||
|
||||
//// [findLast.js]
|
||||
const itemNumber = [0].findLast((item) => item === 0);
|
||||
const itemString = ["string"].findLast((item) => item === "string");
|
||||
new Int8Array().findLast((item) => item === 0);
|
||||
new Uint8Array().findLast((item) => item === 0);
|
||||
new Uint8ClampedArray().findLast((item) => item === 0);
|
||||
new Int16Array().findLast((item) => item === 0);
|
||||
new Uint16Array().findLast((item) => item === 0);
|
||||
new Int32Array().findLast((item) => item === 0);
|
||||
new Uint32Array().findLast((item) => item === 0);
|
||||
new Float32Array().findLast((item) => item === 0);
|
||||
new Float64Array().findLast((item) => item === 0);
|
||||
new BigInt64Array().findLast((item) => item === BigInt(0));
|
||||
new BigUint64Array().findLast((item) => item === BigInt(0));
|
||||
const indexNumber = [0].findLastIndex((item) => item === 0);
|
||||
const indexString = ["string"].findLastIndex((item) => item === "string");
|
||||
new Int8Array().findLastIndex((item) => item === 0);
|
||||
new Uint8Array().findLastIndex((item) => item === 0);
|
||||
new Uint8ClampedArray().findLastIndex((item) => item === 0);
|
||||
new Int16Array().findLastIndex((item) => item === 0);
|
||||
new Uint16Array().findLastIndex((item) => item === 0);
|
||||
new Int32Array().findLastIndex((item) => item === 0);
|
||||
new Uint32Array().findLastIndex((item) => item === 0);
|
||||
new Float32Array().findLastIndex((item) => item === 0);
|
||||
new Float64Array().findLastIndex((item) => item === 0);
|
||||
new BigInt64Array().findLastIndex((item) => item === BigInt(0));
|
||||
new BigUint64Array().findLastIndex((item) => item === BigInt(0));
|
||||
@@ -0,0 +1,187 @@
|
||||
=== tests/cases/compiler/findLast.ts ===
|
||||
const itemNumber: number | undefined = [0].findLast((item) => item === 0);
|
||||
>itemNumber : Symbol(itemNumber, Decl(findLast.ts, 0, 5))
|
||||
>[0].findLast : Symbol(Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>findLast : Symbol(Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 0, 53))
|
||||
>item : Symbol(item, Decl(findLast.ts, 0, 53))
|
||||
|
||||
const itemString: string | undefined = ["string"].findLast((item) => item === "string");
|
||||
>itemString : Symbol(itemString, Decl(findLast.ts, 1, 5))
|
||||
>["string"].findLast : Symbol(Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>findLast : Symbol(Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 1, 60))
|
||||
>item : Symbol(item, Decl(findLast.ts, 1, 60))
|
||||
|
||||
new Int8Array().findLast((item) => item === 0);
|
||||
>new Int8Array().findLast : Symbol(Int8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLast : Symbol(Int8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 2, 26))
|
||||
>item : Symbol(item, Decl(findLast.ts, 2, 26))
|
||||
|
||||
new Uint8Array().findLast((item) => item === 0);
|
||||
>new Uint8Array().findLast : Symbol(Uint8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLast : Symbol(Uint8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 3, 27))
|
||||
>item : Symbol(item, Decl(findLast.ts, 3, 27))
|
||||
|
||||
new Uint8ClampedArray().findLast((item) => item === 0);
|
||||
>new Uint8ClampedArray().findLast : Symbol(Uint8ClampedArray.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLast : Symbol(Uint8ClampedArray.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 4, 34))
|
||||
>item : Symbol(item, Decl(findLast.ts, 4, 34))
|
||||
|
||||
new Int16Array().findLast((item) => item === 0);
|
||||
>new Int16Array().findLast : Symbol(Int16Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLast : Symbol(Int16Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 5, 27))
|
||||
>item : Symbol(item, Decl(findLast.ts, 5, 27))
|
||||
|
||||
new Uint16Array().findLast((item) => item === 0);
|
||||
>new Uint16Array().findLast : Symbol(Uint16Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLast : Symbol(Uint16Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 6, 28))
|
||||
>item : Symbol(item, Decl(findLast.ts, 6, 28))
|
||||
|
||||
new Int32Array().findLast((item) => item === 0);
|
||||
>new Int32Array().findLast : Symbol(Int32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLast : Symbol(Int32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 7, 27))
|
||||
>item : Symbol(item, Decl(findLast.ts, 7, 27))
|
||||
|
||||
new Uint32Array().findLast((item) => item === 0);
|
||||
>new Uint32Array().findLast : Symbol(Uint32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLast : Symbol(Uint32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 8, 28))
|
||||
>item : Symbol(item, Decl(findLast.ts, 8, 28))
|
||||
|
||||
new Float32Array().findLast((item) => item === 0);
|
||||
>new Float32Array().findLast : Symbol(Float32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLast : Symbol(Float32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 9, 29))
|
||||
>item : Symbol(item, Decl(findLast.ts, 9, 29))
|
||||
|
||||
new Float64Array().findLast((item) => item === 0);
|
||||
>new Float64Array().findLast : Symbol(Float64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLast : Symbol(Float64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 10, 29))
|
||||
>item : Symbol(item, Decl(findLast.ts, 10, 29))
|
||||
|
||||
new BigInt64Array().findLast((item) => item === BigInt(0));
|
||||
>new BigInt64Array().findLast : Symbol(BigInt64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>findLast : Symbol(BigInt64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 11, 30))
|
||||
>item : Symbol(item, Decl(findLast.ts, 11, 30))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
new BigUint64Array().findLast((item) => item === BigInt(0));
|
||||
>new BigUint64Array().findLast : Symbol(BigUint64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>findLast : Symbol(BigUint64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 12, 31))
|
||||
>item : Symbol(item, Decl(findLast.ts, 12, 31))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
const indexNumber: number = [0].findLastIndex((item) => item === 0);
|
||||
>indexNumber : Symbol(indexNumber, Decl(findLast.ts, 14, 5))
|
||||
>[0].findLastIndex : Symbol(Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>findLastIndex : Symbol(Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 14, 47))
|
||||
>item : Symbol(item, Decl(findLast.ts, 14, 47))
|
||||
|
||||
const indexString: number = ["string"].findLastIndex((item) => item === "string");
|
||||
>indexString : Symbol(indexString, Decl(findLast.ts, 15, 5))
|
||||
>["string"].findLastIndex : Symbol(Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>findLastIndex : Symbol(Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 15, 54))
|
||||
>item : Symbol(item, Decl(findLast.ts, 15, 54))
|
||||
|
||||
new Int8Array().findLastIndex((item) => item === 0);
|
||||
>new Int8Array().findLastIndex : Symbol(Int8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLastIndex : Symbol(Int8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 16, 31))
|
||||
>item : Symbol(item, Decl(findLast.ts, 16, 31))
|
||||
|
||||
new Uint8Array().findLastIndex((item) => item === 0);
|
||||
>new Uint8Array().findLastIndex : Symbol(Uint8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLastIndex : Symbol(Uint8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 17, 32))
|
||||
>item : Symbol(item, Decl(findLast.ts, 17, 32))
|
||||
|
||||
new Uint8ClampedArray().findLastIndex((item) => item === 0);
|
||||
>new Uint8ClampedArray().findLastIndex : Symbol(Uint8ClampedArray.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLastIndex : Symbol(Uint8ClampedArray.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 18, 39))
|
||||
>item : Symbol(item, Decl(findLast.ts, 18, 39))
|
||||
|
||||
new Int16Array().findLastIndex((item) => item === 0);
|
||||
>new Int16Array().findLastIndex : Symbol(Int16Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLastIndex : Symbol(Int16Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 19, 32))
|
||||
>item : Symbol(item, Decl(findLast.ts, 19, 32))
|
||||
|
||||
new Uint16Array().findLastIndex((item) => item === 0);
|
||||
>new Uint16Array().findLastIndex : Symbol(Uint16Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLastIndex : Symbol(Uint16Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 20, 33))
|
||||
>item : Symbol(item, Decl(findLast.ts, 20, 33))
|
||||
|
||||
new Int32Array().findLastIndex((item) => item === 0);
|
||||
>new Int32Array().findLastIndex : Symbol(Int32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLastIndex : Symbol(Int32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 21, 32))
|
||||
>item : Symbol(item, Decl(findLast.ts, 21, 32))
|
||||
|
||||
new Uint32Array().findLastIndex((item) => item === 0);
|
||||
>new Uint32Array().findLastIndex : Symbol(Uint32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLastIndex : Symbol(Uint32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 22, 33))
|
||||
>item : Symbol(item, Decl(findLast.ts, 22, 33))
|
||||
|
||||
new Float32Array().findLastIndex((item) => item === 0);
|
||||
>new Float32Array().findLastIndex : Symbol(Float32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLastIndex : Symbol(Float32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 23, 34))
|
||||
>item : Symbol(item, Decl(findLast.ts, 23, 34))
|
||||
|
||||
new Float64Array().findLastIndex((item) => item === 0);
|
||||
>new Float64Array().findLastIndex : Symbol(Float64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more)
|
||||
>findLastIndex : Symbol(Float64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 24, 34))
|
||||
>item : Symbol(item, Decl(findLast.ts, 24, 34))
|
||||
|
||||
new BigInt64Array().findLastIndex((item) => item === BigInt(0));
|
||||
>new BigInt64Array().findLastIndex : Symbol(BigInt64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>findLastIndex : Symbol(BigInt64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 25, 35))
|
||||
>item : Symbol(item, Decl(findLast.ts, 25, 35))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
new BigUint64Array().findLastIndex((item) => item === BigInt(0));
|
||||
>new BigUint64Array().findLastIndex : Symbol(BigUint64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --))
|
||||
>findLastIndex : Symbol(BigUint64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --))
|
||||
>item : Symbol(item, Decl(findLast.ts, 26, 36))
|
||||
>item : Symbol(item, Decl(findLast.ts, 26, 36))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
=== tests/cases/compiler/findLast.ts ===
|
||||
const itemNumber: number | undefined = [0].findLast((item) => item === 0);
|
||||
>itemNumber : number
|
||||
>[0].findLast((item) => item === 0) : number
|
||||
>[0].findLast : { <S extends number>(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number; }
|
||||
>[0] : number[]
|
||||
>0 : 0
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
const itemString: string | undefined = ["string"].findLast((item) => item === "string");
|
||||
>itemString : string
|
||||
>["string"].findLast((item) => item === "string") : string
|
||||
>["string"].findLast : { <S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string; }
|
||||
>["string"] : string[]
|
||||
>"string" : "string"
|
||||
>findLast : { <S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string; }
|
||||
>(item) => item === "string" : (item: string) => boolean
|
||||
>item : string
|
||||
>item === "string" : boolean
|
||||
>item : string
|
||||
>"string" : "string"
|
||||
|
||||
new Int8Array().findLast((item) => item === 0);
|
||||
>new Int8Array().findLast((item) => item === 0) : number
|
||||
>new Int8Array().findLast : { <S extends number>(predicate: (value: number, index: number, array: Int8Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): number; }
|
||||
>new Int8Array() : Int8Array
|
||||
>Int8Array : Int8ArrayConstructor
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: Int8Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Uint8Array().findLast((item) => item === 0);
|
||||
>new Uint8Array().findLast((item) => item === 0) : number
|
||||
>new Uint8Array().findLast : { <S extends number>(predicate: (value: number, index: number, array: Uint8Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number; }
|
||||
>new Uint8Array() : Uint8Array
|
||||
>Uint8Array : Uint8ArrayConstructor
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: Uint8Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Uint8ClampedArray().findLast((item) => item === 0);
|
||||
>new Uint8ClampedArray().findLast((item) => item === 0) : number
|
||||
>new Uint8ClampedArray().findLast : { <S extends number>(predicate: (value: number, index: number, array: Uint8ClampedArray) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): number; }
|
||||
>new Uint8ClampedArray() : Uint8ClampedArray
|
||||
>Uint8ClampedArray : Uint8ClampedArrayConstructor
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: Uint8ClampedArray) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Int16Array().findLast((item) => item === 0);
|
||||
>new Int16Array().findLast((item) => item === 0) : number
|
||||
>new Int16Array().findLast : { <S extends number>(predicate: (value: number, index: number, array: Int16Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): number; }
|
||||
>new Int16Array() : Int16Array
|
||||
>Int16Array : Int16ArrayConstructor
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: Int16Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Uint16Array().findLast((item) => item === 0);
|
||||
>new Uint16Array().findLast((item) => item === 0) : number
|
||||
>new Uint16Array().findLast : { <S extends number>(predicate: (value: number, index: number, array: Uint16Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): number; }
|
||||
>new Uint16Array() : Uint16Array
|
||||
>Uint16Array : Uint16ArrayConstructor
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: Uint16Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Int32Array().findLast((item) => item === 0);
|
||||
>new Int32Array().findLast((item) => item === 0) : number
|
||||
>new Int32Array().findLast : { <S extends number>(predicate: (value: number, index: number, array: Int32Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): number; }
|
||||
>new Int32Array() : Int32Array
|
||||
>Int32Array : Int32ArrayConstructor
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: Int32Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Uint32Array().findLast((item) => item === 0);
|
||||
>new Uint32Array().findLast((item) => item === 0) : number
|
||||
>new Uint32Array().findLast : { <S extends number>(predicate: (value: number, index: number, array: Uint32Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): number; }
|
||||
>new Uint32Array() : Uint32Array
|
||||
>Uint32Array : Uint32ArrayConstructor
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: Uint32Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Float32Array().findLast((item) => item === 0);
|
||||
>new Float32Array().findLast((item) => item === 0) : number
|
||||
>new Float32Array().findLast : { <S extends number>(predicate: (value: number, index: number, array: Float32Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): number; }
|
||||
>new Float32Array() : Float32Array
|
||||
>Float32Array : Float32ArrayConstructor
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: Float32Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Float64Array().findLast((item) => item === 0);
|
||||
>new Float64Array().findLast((item) => item === 0) : number
|
||||
>new Float64Array().findLast : { <S extends number>(predicate: (value: number, index: number, array: Float64Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): number; }
|
||||
>new Float64Array() : Float64Array
|
||||
>Float64Array : Float64ArrayConstructor
|
||||
>findLast : { <S extends number>(predicate: (value: number, index: number, array: Float64Array) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): number; }
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new BigInt64Array().findLast((item) => item === BigInt(0));
|
||||
>new BigInt64Array().findLast((item) => item === BigInt(0)) : bigint
|
||||
>new BigInt64Array().findLast : { <S extends bigint>(predicate: (value: bigint, index: number, array: BigInt64Array) => value is S, thisArg?: any): S; (predicate: (value: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any): bigint; }
|
||||
>new BigInt64Array() : BigInt64Array
|
||||
>BigInt64Array : BigInt64ArrayConstructor
|
||||
>findLast : { <S extends bigint>(predicate: (value: bigint, index: number, array: BigInt64Array) => value is S, thisArg?: any): S; (predicate: (value: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any): bigint; }
|
||||
>(item) => item === BigInt(0) : (item: bigint) => boolean
|
||||
>item : bigint
|
||||
>item === BigInt(0) : boolean
|
||||
>item : bigint
|
||||
>BigInt(0) : bigint
|
||||
>BigInt : BigIntConstructor
|
||||
>0 : 0
|
||||
|
||||
new BigUint64Array().findLast((item) => item === BigInt(0));
|
||||
>new BigUint64Array().findLast((item) => item === BigInt(0)) : bigint
|
||||
>new BigUint64Array().findLast : { <S extends bigint>(predicate: (value: bigint, index: number, array: BigUint64Array) => value is S, thisArg?: any): S; (predicate: (value: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any): bigint; }
|
||||
>new BigUint64Array() : BigUint64Array
|
||||
>BigUint64Array : BigUint64ArrayConstructor
|
||||
>findLast : { <S extends bigint>(predicate: (value: bigint, index: number, array: BigUint64Array) => value is S, thisArg?: any): S; (predicate: (value: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any): bigint; }
|
||||
>(item) => item === BigInt(0) : (item: bigint) => boolean
|
||||
>item : bigint
|
||||
>item === BigInt(0) : boolean
|
||||
>item : bigint
|
||||
>BigInt(0) : bigint
|
||||
>BigInt : BigIntConstructor
|
||||
>0 : 0
|
||||
|
||||
const indexNumber: number = [0].findLastIndex((item) => item === 0);
|
||||
>indexNumber : number
|
||||
>[0].findLastIndex((item) => item === 0) : number
|
||||
>[0].findLastIndex : (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => number
|
||||
>[0] : number[]
|
||||
>0 : 0
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
const indexString: number = ["string"].findLastIndex((item) => item === "string");
|
||||
>indexString : number
|
||||
>["string"].findLastIndex((item) => item === "string") : number
|
||||
>["string"].findLastIndex : (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => number
|
||||
>["string"] : string[]
|
||||
>"string" : "string"
|
||||
>findLastIndex : (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => number
|
||||
>(item) => item === "string" : (item: string) => boolean
|
||||
>item : string
|
||||
>item === "string" : boolean
|
||||
>item : string
|
||||
>"string" : "string"
|
||||
|
||||
new Int8Array().findLastIndex((item) => item === 0);
|
||||
>new Int8Array().findLastIndex((item) => item === 0) : number
|
||||
>new Int8Array().findLastIndex : (predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any) => number
|
||||
>new Int8Array() : Int8Array
|
||||
>Int8Array : Int8ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Uint8Array().findLastIndex((item) => item === 0);
|
||||
>new Uint8Array().findLastIndex((item) => item === 0) : number
|
||||
>new Uint8Array().findLastIndex : (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => number
|
||||
>new Uint8Array() : Uint8Array
|
||||
>Uint8Array : Uint8ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Uint8ClampedArray().findLastIndex((item) => item === 0);
|
||||
>new Uint8ClampedArray().findLastIndex((item) => item === 0) : number
|
||||
>new Uint8ClampedArray().findLastIndex : (predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any) => number
|
||||
>new Uint8ClampedArray() : Uint8ClampedArray
|
||||
>Uint8ClampedArray : Uint8ClampedArrayConstructor
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Int16Array().findLastIndex((item) => item === 0);
|
||||
>new Int16Array().findLastIndex((item) => item === 0) : number
|
||||
>new Int16Array().findLastIndex : (predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any) => number
|
||||
>new Int16Array() : Int16Array
|
||||
>Int16Array : Int16ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Uint16Array().findLastIndex((item) => item === 0);
|
||||
>new Uint16Array().findLastIndex((item) => item === 0) : number
|
||||
>new Uint16Array().findLastIndex : (predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any) => number
|
||||
>new Uint16Array() : Uint16Array
|
||||
>Uint16Array : Uint16ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Int32Array().findLastIndex((item) => item === 0);
|
||||
>new Int32Array().findLastIndex((item) => item === 0) : number
|
||||
>new Int32Array().findLastIndex : (predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any) => number
|
||||
>new Int32Array() : Int32Array
|
||||
>Int32Array : Int32ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Uint32Array().findLastIndex((item) => item === 0);
|
||||
>new Uint32Array().findLastIndex((item) => item === 0) : number
|
||||
>new Uint32Array().findLastIndex : (predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any) => number
|
||||
>new Uint32Array() : Uint32Array
|
||||
>Uint32Array : Uint32ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Float32Array().findLastIndex((item) => item === 0);
|
||||
>new Float32Array().findLastIndex((item) => item === 0) : number
|
||||
>new Float32Array().findLastIndex : (predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any) => number
|
||||
>new Float32Array() : Float32Array
|
||||
>Float32Array : Float32ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new Float64Array().findLastIndex((item) => item === 0);
|
||||
>new Float64Array().findLastIndex((item) => item === 0) : number
|
||||
>new Float64Array().findLastIndex : (predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any) => number
|
||||
>new Float64Array() : Float64Array
|
||||
>Float64Array : Float64ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === 0 : (item: number) => boolean
|
||||
>item : number
|
||||
>item === 0 : boolean
|
||||
>item : number
|
||||
>0 : 0
|
||||
|
||||
new BigInt64Array().findLastIndex((item) => item === BigInt(0));
|
||||
>new BigInt64Array().findLastIndex((item) => item === BigInt(0)) : number
|
||||
>new BigInt64Array().findLastIndex : (predicate: (value: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any) => number
|
||||
>new BigInt64Array() : BigInt64Array
|
||||
>BigInt64Array : BigInt64ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === BigInt(0) : (item: bigint) => boolean
|
||||
>item : bigint
|
||||
>item === BigInt(0) : boolean
|
||||
>item : bigint
|
||||
>BigInt(0) : bigint
|
||||
>BigInt : BigIntConstructor
|
||||
>0 : 0
|
||||
|
||||
new BigUint64Array().findLastIndex((item) => item === BigInt(0));
|
||||
>new BigUint64Array().findLastIndex((item) => item === BigInt(0)) : number
|
||||
>new BigUint64Array().findLastIndex : (predicate: (value: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any) => number
|
||||
>new BigUint64Array() : BigUint64Array
|
||||
>BigUint64Array : BigUint64ArrayConstructor
|
||||
>findLastIndex : (predicate: (value: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any) => number
|
||||
>(item) => item === BigInt(0) : (item: bigint) => boolean
|
||||
>item : bigint
|
||||
>item === BigInt(0) : boolean
|
||||
>item : bigint
|
||||
>BigInt(0) : bigint
|
||||
>BigInt : BigIntConstructor
|
||||
>0 : 0
|
||||
|
||||
@@ -34,10 +34,11 @@ function func3<T extends { kind: "a", a: string } | { kind: "b", b: number }>(t:
|
||||
|
||||
function farr<T extends [number, string, string] | [string, number, number]>(x: T) {
|
||||
const [head, ...tail] = x;
|
||||
if (x[0] === 'number') {
|
||||
if (typeof x[0] === 'number') {
|
||||
const [head, ...tail] = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [narrowingDestructuring.js]
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
@@ -83,7 +84,7 @@ function func3(t) {
|
||||
}
|
||||
function farr(x) {
|
||||
var head = x[0], tail = x.slice(1);
|
||||
if (x[0] === 'number') {
|
||||
if (typeof x[0] === 'number') {
|
||||
var head_1 = x[0], tail_1 = x.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ function farr<T extends [number, string, string] | [string, number, number]>(x:
|
||||
>tail : Symbol(tail, Decl(narrowingDestructuring.ts, 34, 16))
|
||||
>x : Symbol(x, Decl(narrowingDestructuring.ts, 33, 77))
|
||||
|
||||
if (x[0] === 'number') {
|
||||
if (typeof x[0] === 'number') {
|
||||
>x : Symbol(x, Decl(narrowingDestructuring.ts, 33, 77))
|
||||
>0 : Symbol(0)
|
||||
|
||||
@@ -146,3 +146,4 @@ function farr<T extends [number, string, string] | [string, number, number]>(x:
|
||||
>x : Symbol(x, Decl(narrowingDestructuring.ts, 33, 77))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,16 +135,18 @@ function farr<T extends [number, string, string] | [string, number, number]>(x:
|
||||
>tail : [string, string] | [number, number]
|
||||
>x : [number, string, string] | [string, number, number]
|
||||
|
||||
if (x[0] === 'number') {
|
||||
>x[0] === 'number' : boolean
|
||||
if (typeof x[0] === 'number') {
|
||||
>typeof x[0] === 'number' : boolean
|
||||
>typeof x[0] : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x[0] : string | number
|
||||
>x : [number, string, string] | [string, number, number]
|
||||
>0 : 0
|
||||
>'number' : "number"
|
||||
|
||||
const [head, ...tail] = x;
|
||||
>head : "number"
|
||||
>head : number
|
||||
>tail : [string, string] | [number, number]
|
||||
>x : [number, string, string] | [string, number, number]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [potentiallyUnassignedVariableInCatch.ts]
|
||||
let foo;
|
||||
try {
|
||||
if (Math.random() > 0.5) {
|
||||
foo = 1234;
|
||||
}
|
||||
} catch {
|
||||
foo;
|
||||
}
|
||||
|
||||
|
||||
//// [potentiallyUnassignedVariableInCatch.js]
|
||||
"use strict";
|
||||
var foo;
|
||||
try {
|
||||
if (Math.random() > 0.5) {
|
||||
foo = 1234;
|
||||
}
|
||||
}
|
||||
catch (_a) {
|
||||
foo;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/potentiallyUnassignedVariableInCatch.ts ===
|
||||
let foo;
|
||||
>foo : Symbol(foo, Decl(potentiallyUnassignedVariableInCatch.ts, 0, 3))
|
||||
|
||||
try {
|
||||
if (Math.random() > 0.5) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
foo = 1234;
|
||||
>foo : Symbol(foo, Decl(potentiallyUnassignedVariableInCatch.ts, 0, 3))
|
||||
}
|
||||
} catch {
|
||||
foo;
|
||||
>foo : Symbol(foo, Decl(potentiallyUnassignedVariableInCatch.ts, 0, 3))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/compiler/potentiallyUnassignedVariableInCatch.ts ===
|
||||
let foo;
|
||||
>foo : any
|
||||
|
||||
try {
|
||||
if (Math.random() > 0.5) {
|
||||
>Math.random() > 0.5 : boolean
|
||||
>Math.random() : number
|
||||
>Math.random : () => number
|
||||
>Math : Math
|
||||
>random : () => number
|
||||
>0.5 : 0.5
|
||||
|
||||
foo = 1234;
|
||||
>foo = 1234 : 1234
|
||||
>foo : any
|
||||
>1234 : 1234
|
||||
}
|
||||
} catch {
|
||||
foo;
|
||||
>foo : number | undefined
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [substitutionTypePassedToExtends.ts]
|
||||
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
|
||||
type Bar1<T extends unknown[][]> = T
|
||||
|
||||
type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
|
||||
type Bar2<T extends Set<unknown[]>> = T
|
||||
|
||||
|
||||
//// [substitutionTypePassedToExtends.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/substitutionTypePassedToExtends.ts ===
|
||||
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
|
||||
>Foo1 : Symbol(Foo1, Decl(substitutionTypePassedToExtends.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 0, 10))
|
||||
>B : Symbol(B, Decl(substitutionTypePassedToExtends.ts, 0, 12))
|
||||
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 0, 10))
|
||||
>B : Symbol(B, Decl(substitutionTypePassedToExtends.ts, 0, 12))
|
||||
>Bar1 : Symbol(Bar1, Decl(substitutionTypePassedToExtends.ts, 0, 67))
|
||||
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 0, 10))
|
||||
>B : Symbol(B, Decl(substitutionTypePassedToExtends.ts, 0, 12))
|
||||
|
||||
type Bar1<T extends unknown[][]> = T
|
||||
>Bar1 : Symbol(Bar1, Decl(substitutionTypePassedToExtends.ts, 0, 67))
|
||||
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 1, 10))
|
||||
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 1, 10))
|
||||
|
||||
type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
|
||||
>Foo2 : Symbol(Foo2, Decl(substitutionTypePassedToExtends.ts, 1, 36))
|
||||
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))
|
||||
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))
|
||||
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>Bar2 : Symbol(Bar2, Decl(substitutionTypePassedToExtends.ts, 3, 68))
|
||||
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))
|
||||
|
||||
type Bar2<T extends Set<unknown[]>> = T
|
||||
>Bar2 : Symbol(Bar2, Decl(substitutionTypePassedToExtends.ts, 3, 68))
|
||||
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 4, 10))
|
||||
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 4, 10))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/substitutionTypePassedToExtends.ts ===
|
||||
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
|
||||
>Foo1 : Foo1<A, B>
|
||||
|
||||
type Bar1<T extends unknown[][]> = T
|
||||
>Bar1 : T
|
||||
|
||||
type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
|
||||
>Foo2 : Foo2<A>
|
||||
|
||||
type Bar2<T extends Set<unknown[]>> = T
|
||||
>Bar2 : T
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/decl.d.ts(2,1): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
|
||||
/main.ts(1,8): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
|
||||
/main.ts(2,13): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
|
||||
/main.ts(3,10): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
|
||||
@@ -12,13 +11,17 @@
|
||||
/main7.ts(2,1): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
|
||||
|
||||
|
||||
==== /decl.d.ts (1 errors) ====
|
||||
==== /decl.d.ts (0 errors) ====
|
||||
declare function esmy(): void;
|
||||
export default esmy;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
|
||||
export declare function funciton(): void;
|
||||
|
||||
==== /ambient.d.ts (0 errors) ====
|
||||
declare module "ambient" {
|
||||
const _default: number;
|
||||
export default _default;
|
||||
}
|
||||
|
||||
==== /main.ts (6 errors) ====
|
||||
import esmy from "./decl"; // error
|
||||
~~~~
|
||||
|
||||
@@ -5,6 +5,12 @@ declare function esmy(): void;
|
||||
export default esmy;
|
||||
export declare function funciton(): void;
|
||||
|
||||
//// [ambient.d.ts]
|
||||
declare module "ambient" {
|
||||
const _default: number;
|
||||
export default _default;
|
||||
}
|
||||
|
||||
//// [main.ts]
|
||||
import esmy from "./decl"; // error
|
||||
import * as esmy2 from "./decl"; // error
|
||||
|
||||
@@ -8,6 +8,17 @@ export default esmy;
|
||||
export declare function funciton(): void;
|
||||
>funciton : Symbol(funciton, Decl(decl.d.ts, 1, 20))
|
||||
|
||||
=== /ambient.d.ts ===
|
||||
declare module "ambient" {
|
||||
>"ambient" : Symbol("ambient", Decl(ambient.d.ts, 0, 0))
|
||||
|
||||
const _default: number;
|
||||
>_default : Symbol(_default, Decl(ambient.d.ts, 1, 9))
|
||||
|
||||
export default _default;
|
||||
>_default : Symbol(_default, Decl(ambient.d.ts, 1, 9))
|
||||
}
|
||||
|
||||
=== /main.ts ===
|
||||
import esmy from "./decl"; // error
|
||||
>esmy : Symbol(esmy, Decl(main.ts, 0, 6))
|
||||
|
||||
@@ -8,6 +8,17 @@ export default esmy;
|
||||
export declare function funciton(): void;
|
||||
>funciton : () => void
|
||||
|
||||
=== /ambient.d.ts ===
|
||||
declare module "ambient" {
|
||||
>"ambient" : typeof import("ambient")
|
||||
|
||||
const _default: number;
|
||||
>_default : number
|
||||
|
||||
export default _default;
|
||||
>_default : number
|
||||
}
|
||||
|
||||
=== /main.ts ===
|
||||
import esmy from "./decl"; // error
|
||||
>esmy : () => void
|
||||
|
||||
+6
@@ -17,6 +17,12 @@
|
||||
declare class CJSy {}
|
||||
export = CJSy;
|
||||
|
||||
==== /ambient.d.ts (0 errors) ====
|
||||
declare module "ambient" {
|
||||
const _export: number;
|
||||
export = _export;
|
||||
}
|
||||
|
||||
==== /types.ts (0 errors) ====
|
||||
interface Typey {}
|
||||
export type { Typey };
|
||||
|
||||
+6
@@ -4,6 +4,12 @@
|
||||
declare class CJSy {}
|
||||
export = CJSy;
|
||||
|
||||
//// [ambient.d.ts]
|
||||
declare module "ambient" {
|
||||
const _export: number;
|
||||
export = _export;
|
||||
}
|
||||
|
||||
//// [types.ts]
|
||||
interface Typey {}
|
||||
export type { Typey };
|
||||
|
||||
+6
@@ -13,6 +13,12 @@
|
||||
declare class CJSy {}
|
||||
export = CJSy;
|
||||
|
||||
==== /ambient.d.ts (0 errors) ====
|
||||
declare module "ambient" {
|
||||
const _export: number;
|
||||
export = _export;
|
||||
}
|
||||
|
||||
==== /types.ts (0 errors) ====
|
||||
interface Typey {}
|
||||
export type { Typey };
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
declare class CJSy {}
|
||||
export = CJSy;
|
||||
|
||||
//// [ambient.d.ts]
|
||||
declare module "ambient" {
|
||||
const _export: number;
|
||||
export = _export;
|
||||
}
|
||||
|
||||
//// [types.ts]
|
||||
interface Typey {}
|
||||
export type { Typey };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// @target: esnext
|
||||
// @target: esnext, es2022
|
||||
|
||||
const itemNumber: number | undefined = [0].findLast((item) => item === 0);
|
||||
const itemString: string | undefined = ["string"].findLast((item) => item === "string");
|
||||
|
||||
@@ -33,7 +33,7 @@ function func3<T extends { kind: "a", a: string } | { kind: "b", b: number }>(t:
|
||||
|
||||
function farr<T extends [number, string, string] | [string, number, number]>(x: T) {
|
||||
const [head, ...tail] = x;
|
||||
if (x[0] === 'number') {
|
||||
if (typeof x[0] === 'number') {
|
||||
const [head, ...tail] = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// @strict: true
|
||||
|
||||
let foo;
|
||||
try {
|
||||
if (Math.random() > 0.5) {
|
||||
foo = 1234;
|
||||
}
|
||||
} catch {
|
||||
foo;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// @strict: true
|
||||
// @target: esnext
|
||||
|
||||
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
|
||||
type Bar1<T extends unknown[][]> = T
|
||||
|
||||
type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
|
||||
type Bar2<T extends Set<unknown[]>> = T
|
||||
@@ -9,6 +9,12 @@ declare function esmy(): void;
|
||||
export default esmy;
|
||||
export declare function funciton(): void;
|
||||
|
||||
// @Filename: /ambient.d.ts
|
||||
declare module "ambient" {
|
||||
const _default: number;
|
||||
export default _default;
|
||||
}
|
||||
|
||||
// @Filename: /main.ts
|
||||
import esmy from "./decl"; // error
|
||||
import * as esmy2 from "./decl"; // error
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
declare class CJSy {}
|
||||
export = CJSy;
|
||||
|
||||
// @Filename: /ambient.d.ts
|
||||
declare module "ambient" {
|
||||
const _export: number;
|
||||
export = _export;
|
||||
}
|
||||
|
||||
// @Filename: /types.ts
|
||||
interface Typey {}
|
||||
export type { Typey };
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @filename: /a.ts
|
||||
/////**
|
||||
//// * @param {string} y
|
||||
//// * @returns
|
||||
//// */
|
||||
////export const foo = (x: string) => x;
|
||||
|
||||
verify.codeFix({
|
||||
description: [ts.Diagnostics.Rename_param_tag_name_0_to_1.message, "y", "x"],
|
||||
index: 1,
|
||||
newFileContent:
|
||||
`/**
|
||||
* @param {string} x
|
||||
* @returns
|
||||
*/
|
||||
export const foo = (x: string) => x;`,
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
const singleLineOffset = 3;
|
||||
const multiLineOffset = 12;
|
||||
const multiLineOffset = 11;
|
||||
|
||||
|
||||
////class C {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
const multiLineOffset = 12;
|
||||
const multiLineOffset = 11;
|
||||
|
||||
////class C {
|
||||
//// /*0*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
const singleLineOffset = 3;
|
||||
const multiLineOffset = 12;
|
||||
const multiLineOffset = 11;
|
||||
|
||||
|
||||
////class C {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
const newTextOffset = 12;
|
||||
const newTextOffset = 11;
|
||||
verify.docCommentTemplateAt("0", /*newTextOffset*/ newTextOffset,
|
||||
`/**
|
||||
*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
//// exports.foo = (a) => {};
|
||||
|
||||
|
||||
verify.docCommentTemplateAt("", 8,
|
||||
verify.docCommentTemplateAt("", 7,
|
||||
`/**
|
||||
*
|
||||
* @param {any} a
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
////const x = /*next*/ function f(p) {}
|
||||
|
||||
for (const marker of test.markerNames()) {
|
||||
verify.docCommentTemplateAt(marker, 8,
|
||||
verify.docCommentTemplateAt(marker, 7,
|
||||
`/**
|
||||
*
|
||||
* @param p
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
const noIndentScaffolding = "/**\n * \n * @param x\n * @param y\n */";
|
||||
const oneIndentScaffolding = "/**\n * \n * @param x\n * @param y\n */";
|
||||
const noIndentOffset = 8;
|
||||
const noIndentOffset = 7;
|
||||
const oneIndentOffset = noIndentOffset + 4;
|
||||
|
||||
goTo.marker("0");
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/////*0*/
|
||||
////function f(a, ...b): boolean {}
|
||||
|
||||
verify.docCommentTemplateAt("0", 8,
|
||||
verify.docCommentTemplateAt("0", 7,
|
||||
`/**
|
||||
*
|
||||
* @param {any} a
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//// foo: (a: number, b: string) => void;
|
||||
////}
|
||||
|
||||
verify.docCommentTemplateAt("", 12,
|
||||
verify.docCommentTemplateAt("", 11,
|
||||
`/**
|
||||
*
|
||||
* @param a
|
||||
@@ -13,7 +13,7 @@ verify.docCommentTemplateAt("", 12,
|
||||
* @returns
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("", 12,
|
||||
verify.docCommentTemplateAt("", 11,
|
||||
`/**
|
||||
*
|
||||
* @param a
|
||||
|
||||
@@ -30,7 +30,7 @@ verify.docCommentTemplateAt("interfaceFoo", /*expectedOffset*/ 3,
|
||||
verify.docCommentTemplateAt("propertybar", /*expectedOffset*/ 3,
|
||||
"/** */");
|
||||
|
||||
verify.docCommentTemplateAt("methodbaz", /*expectedOffset*/ 12,
|
||||
verify.docCommentTemplateAt("methodbaz", /*expectedOffset*/ 11,
|
||||
`/**
|
||||
*
|
||||
* @param message
|
||||
@@ -46,4 +46,4 @@ verify.docCommentTemplateAt("memberOpen", /*expectedOffset*/ 3,
|
||||
"/** */");
|
||||
|
||||
verify.docCommentTemplateAt("memberClosed", /*expectedOffset*/ 3,
|
||||
"/** */");
|
||||
"/** */");
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
////const myNamespace = {};
|
||||
/////*1*/myNamespace.myExport = function(x) {};
|
||||
|
||||
verify.docCommentTemplateAt("0", 8,
|
||||
verify.docCommentTemplateAt("0", 7,
|
||||
`/**
|
||||
*
|
||||
* @param {any} a
|
||||
*/
|
||||
`);
|
||||
|
||||
verify.docCommentTemplateAt("1", 8,
|
||||
verify.docCommentTemplateAt("1", 7,
|
||||
`/**
|
||||
*
|
||||
* @param {any} x
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
const multiLineOffset = 12;
|
||||
const multiLineOffset = 11;
|
||||
|
||||
////var x = {
|
||||
//// /*0*/
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
////C.prototype.method = /*next*/ function (p) {}
|
||||
|
||||
for (const marker of test.markerNames()) {
|
||||
verify.docCommentTemplateAt(marker, 8,
|
||||
verify.docCommentTemplateAt(marker, 7,
|
||||
`/**
|
||||
*
|
||||
* @param {any} p
|
||||
|
||||
@@ -28,19 +28,19 @@
|
||||
|
||||
verify.docCommentTemplateAt("0", 3, "/** */");
|
||||
|
||||
verify.docCommentTemplateAt("1", 8,
|
||||
verify.docCommentTemplateAt("1", 7,
|
||||
`/**
|
||||
*
|
||||
* @returns
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("2", 8,
|
||||
verify.docCommentTemplateAt("2", 7,
|
||||
`/**
|
||||
*
|
||||
* @returns
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("3", 8,
|
||||
verify.docCommentTemplateAt("3", 7,
|
||||
`/**
|
||||
*
|
||||
* @returns
|
||||
@@ -49,7 +49,7 @@ verify.docCommentTemplateAt("3", 8,
|
||||
verify.docCommentTemplateAt("4", 3, "/** */");
|
||||
|
||||
|
||||
verify.docCommentTemplateAt("5", 12,
|
||||
verify.docCommentTemplateAt("5", 11,
|
||||
`/**
|
||||
*
|
||||
* @returns
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//// return 1;
|
||||
////}
|
||||
|
||||
verify.docCommentTemplateAt("0", 8,
|
||||
verify.docCommentTemplateAt("0", 7,
|
||||
`/**
|
||||
*
|
||||
* @param x
|
||||
@@ -13,7 +13,7 @@ verify.docCommentTemplateAt("0", 8,
|
||||
* @returns
|
||||
*/`, { generateReturnInDocTemplate: true });
|
||||
|
||||
verify.docCommentTemplateAt("0", 8,
|
||||
verify.docCommentTemplateAt("0", 7,
|
||||
`/**
|
||||
*
|
||||
* @param x
|
||||
|
||||
@@ -33,7 +33,7 @@ for (const varName of ["a", "b", "c", "d"]) {
|
||||
"/** */");
|
||||
}
|
||||
|
||||
verify.docCommentTemplateAt("e", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("e", /*newTextOffset*/ 7,
|
||||
`/**
|
||||
*
|
||||
* @param x
|
||||
@@ -42,10 +42,10 @@ verify.docCommentTemplateAt("e", /*newTextOffset*/ 8,
|
||||
* @returns
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("f", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("f", /*newTextOffset*/ 7,
|
||||
`/**
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @param c
|
||||
*/`);
|
||||
*/`);
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
//// }
|
||||
////}))
|
||||
|
||||
verify.docCommentTemplateAt("a", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("a", /*newTextOffset*/ 7,
|
||||
`/**
|
||||
*
|
||||
* @param x
|
||||
* @returns
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("b", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("b", /*newTextOffset*/ 7,
|
||||
`/**
|
||||
*
|
||||
* @param x
|
||||
@@ -45,7 +45,7 @@ verify.docCommentTemplateAt("b", /*newTextOffset*/ 8,
|
||||
* @returns
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("c", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("c", /*newTextOffset*/ 7,
|
||||
`/**
|
||||
*
|
||||
* @param x
|
||||
@@ -55,7 +55,7 @@ verify.docCommentTemplateAt("c", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("d", /*newTextOffset*/ 3,
|
||||
"/** */");
|
||||
|
||||
verify.docCommentTemplateAt("e", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("e", /*newTextOffset*/ 7,
|
||||
`/**
|
||||
*
|
||||
* @param param0
|
||||
@@ -65,8 +65,8 @@ verify.docCommentTemplateAt("e", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("f", /*newTextOffset*/ 3,
|
||||
"/** */");
|
||||
|
||||
verify.docCommentTemplateAt("g", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("g", /*newTextOffset*/ 7,
|
||||
`/**
|
||||
*
|
||||
* @param x
|
||||
*/`);
|
||||
*/`);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/////** Doc/*1*/ */
|
||||
////function g(p) { return p; }
|
||||
|
||||
verify.docCommentTemplateAt("", /*newTextOffset*/ 8,
|
||||
verify.docCommentTemplateAt("", /*newTextOffset*/ 7,
|
||||
`/**
|
||||
*
|
||||
* @param p
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
/////**
|
||||
//// * @typedef Foo
|
||||
//// * @pr/**/
|
||||
//// */
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
includes: ["prop"],
|
||||
});
|
||||
Reference in New Issue
Block a user