Merge branch 'master' into vfs

This commit is contained in:
Ron Buckton committed 2018-01-29 11:05:07 -08:00
commit 7ca84aca52
158 files changed
+3331 -540

No files matched your search

+1 -1
View File
@@ -594,7 +594,7 @@ task("configure-insiders", [configurePrereleaseJs], function () {
}, { async: true });
desc("Configure, build, test, and publish the insiders release.");
task("publish-insiders", ["configure-nightly", "LKG", "clean", "setDebugMode", "runtests-parallel"], function () {
task("publish-insiders", ["configure-insiders", "LKG", "clean", "setDebugMode", "runtests-parallel"], function () {
var cmd = "npm publish --tag insiders";
console.log(cmd);
exec(cmd);
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "2.7.0",
"version": "2.8.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+29 -25
View File
@@ -2424,12 +2424,15 @@ namespace ts {
const visitedSymbolTables: SymbolTable[] = [];
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable): Symbol[] | undefined {
/**
* @param {ignoreQualification} boolean Set when a symbol is being looked for through the exports of another symbol (meaning we have a route to qualify it already)
*/
function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable, ignoreQualification?: boolean): Symbol[] | undefined {
if (!pushIfUnique(visitedSymbolTables, symbols)) {
return undefined;
}
const result = trySymbolTable(symbols);
const result = trySymbolTable(symbols, ignoreQualification);
visitedSymbolTables.pop();
return result;
}
@@ -2441,22 +2444,22 @@ namespace ts {
!!getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing);
}
function isAccessible(symbolFromSymbolTable: Symbol, resolvedAliasSymbol?: Symbol) {
function isAccessible(symbolFromSymbolTable: Symbol, resolvedAliasSymbol?: Symbol, ignoreQualification?: boolean) {
return symbol === (resolvedAliasSymbol || symbolFromSymbolTable) &&
// if the symbolFromSymbolTable is not external module (it could be if it was determined as ambient external module and would be in globals table)
// and if symbolFromSymbolTable or alias resolution matches the symbol,
// check the symbol can be qualified, it is only then this symbol is accessible
!some(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) &&
canQualifySymbol(symbolFromSymbolTable, meaning);
(ignoreQualification || canQualifySymbol(symbolFromSymbolTable, meaning));
}
function isUMDExportSymbol(symbol: Symbol) {
return symbol && symbol.declarations && symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
}
function trySymbolTable(symbols: SymbolTable) {
function trySymbolTable(symbols: SymbolTable, ignoreQualification: boolean | undefined) {
// If symbol is directly available by its name in the symbol table
if (isAccessible(symbols.get(symbol.escapedName))) {
if (isAccessible(symbols.get(symbol.escapedName), /*resolvedAliasSymbol*/ undefined, ignoreQualification)) {
return [symbol];
}
@@ -2469,14 +2472,14 @@ namespace ts {
&& (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration))) {
const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol)) {
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
return [symbolFromSymbolTable];
}
// Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain
// but only if the symbolFromSymbolTable can be qualified
const candidateTable = getExportsOfSymbol(resolvedImportedSymbol);
const accessibleSymbolsFromExports = candidateTable && getAccessibleSymbolChainFromSymbolTable(candidateTable);
const accessibleSymbolsFromExports = candidateTable && getAccessibleSymbolChainFromSymbolTable(candidateTable, /*ignoreQualification*/ true);
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
}
@@ -5995,7 +5998,9 @@ namespace ts {
for (const memberType of types) {
for (const { escapedName } of getAugmentedPropertiesOfType(memberType)) {
if (!props.has(escapedName)) {
props.set(escapedName, createUnionOrIntersectionProperty(unionType as UnionType, escapedName));
const prop = createUnionOrIntersectionProperty(unionType as UnionType, escapedName);
// May be undefined if the property is private
if (prop) props.set(escapedName, prop);
}
}
}
@@ -6177,7 +6182,7 @@ namespace ts {
t;
}
function createUnionOrIntersectionProperty(containingType: UnionOrIntersectionType, name: __String): Symbol {
function createUnionOrIntersectionProperty(containingType: UnionOrIntersectionType, name: __String): Symbol | undefined {
let props: Symbol[];
const isUnion = containingType.flags & TypeFlags.Union;
const excludeModifiers = isUnion ? ModifierFlags.NonPublicAccessibilityModifier : 0;
@@ -9220,7 +9225,8 @@ namespace ts {
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return Ternary.True;
if (isObjectLiteralType(source) && source.flags & TypeFlags.FreshLiteral) {
if (hasExcessProperties(<FreshObjectLiteralType>source, target, reportErrors)) {
const discriminantType = target.flags & TypeFlags.Union ? findMatchingDiscriminantType(source, target as UnionType) : undefined;
if (hasExcessProperties(<FreshObjectLiteralType>source, target, discriminantType, reportErrors)) {
if (reportErrors) {
reportRelationError(headMessage, source, target);
}
@@ -9230,7 +9236,7 @@ namespace ts {
// and intersection types are further deconstructed on the target side, we don't want to
// make the check again (as it might fail for a partial target type). Therefore we obtain
// the regular source type and proceed with that.
if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) {
if (isUnionOrIntersectionTypeWithoutNullableConstituents(target) && !discriminantType) {
source = getRegularTypeOfObjectLiteral(source);
}
}
@@ -9331,19 +9337,16 @@ namespace ts {
return Ternary.False;
}
function hasExcessProperties(source: FreshObjectLiteralType, target: Type, reportErrors: boolean): boolean {
function hasExcessProperties(source: FreshObjectLiteralType, target: Type, discriminant: Type | undefined, reportErrors: boolean): boolean {
if (maybeTypeOfKind(target, TypeFlags.Object) && !(getObjectFlags(target) & ObjectFlags.ObjectLiteralPatternWithComputedProperties)) {
const isComparingJsxAttributes = !!(source.flags & TypeFlags.JsxAttributes);
if ((relation === assignableRelation || relation === comparableRelation) &&
(isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
return false;
}
if (target.flags & TypeFlags.Union) {
const discriminantType = findMatchingDiscriminantType(source, target as UnionType);
if (discriminantType) {
// check excess properties against discriminant type only, not the entire union
return hasExcessProperties(source, discriminantType, reportErrors);
}
if (discriminant) {
// check excess properties against discriminant type only, not the entire union
return hasExcessProperties(source, discriminant, /*discriminant*/ undefined, reportErrors);
}
for (const prop of getPropertiesOfObjectType(source)) {
if (!isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) {
@@ -13046,7 +13049,7 @@ namespace ts {
node.parent.kind === SyntaxKind.NonNullExpression ||
declaration.kind === SyntaxKind.VariableDeclaration && (<VariableDeclaration>declaration).exclamationToken ||
declaration.flags & NodeFlags.Ambient;
const initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, getRootDeclaration(declaration) as VariableLikeDeclaration) : type) :
const initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration as VariableLikeDeclaration) : type) :
type === autoType || type === autoArrayType ? undefinedType :
getOptionalType(type);
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer, !assumeInitialized);
@@ -15308,7 +15311,7 @@ namespace ts {
// If the targetAttributesType is an emptyObjectType, indicating that there is no property named 'props' on this instance type.
// but there exists a sourceAttributesType, we need to explicitly give an error as normal assignability check allow excess properties and will pass.
if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || (<ResolvedType>sourceAttributesType).properties.length > 0)) {
if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || getPropertiesOfType(<ResolvedType>sourceAttributesType).length > 0)) {
error(openingLikeElement, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(getJsxElementPropertiesName()));
}
else {
@@ -16715,7 +16718,7 @@ namespace ts {
const isDecorator = node.kind === SyntaxKind.Decorator;
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
let typeArguments: ReadonlyArray<TypeNode>;
let typeArguments: NodeArray<TypeNode>;
if (!isTaggedTemplate && !isDecorator && !isJsxOpeningOrSelfClosingElement) {
typeArguments = (<CallExpression>node).typeArguments;
@@ -16844,7 +16847,7 @@ namespace ts {
max = Math.max(max, length(sig.typeParameters));
}
const paramCount = min < max ? min + "-" + max : min;
diagnostics.add(createDiagnosticForNode(node, Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length));
diagnostics.add(createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length));
}
else if (args) {
let min = Number.POSITIVE_INFINITY;
@@ -20964,7 +20967,7 @@ namespace ts {
error(name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(local));
}
}
else if (compilerOptions.noUnusedLocals) {
else if (local.flags & SymbolFlags.TypeParameter ? compilerOptions.noUnusedParameters : compilerOptions.noUnusedLocals) {
forEach(local.declarations, d => errorUnusedLocal(d, symbolName(local)));
}
}
@@ -21028,6 +21031,7 @@ namespace ts {
}
break;
case SyntaxKind.IndexSignature:
case SyntaxKind.SemicolonClassElement:
// Can't be private
break;
default:
@@ -21038,7 +21042,7 @@ namespace ts {
}
function checkUnusedTypeParameters(node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration | TypeAliasDeclaration) {
if (compilerOptions.noUnusedLocals && !(node.flags & NodeFlags.Ambient)) {
if (compilerOptions.noUnusedParameters && !(node.flags & NodeFlags.Ambient)) {
if (node.typeParameters) {
// Only report errors on the last declaration for the type parameter container;
// this ensures that all uses have been accounted for.
+6
View File
@@ -186,6 +186,12 @@ namespace ts {
category: Diagnostics.Basic_Options,
description: Diagnostics.Generates_corresponding_d_ts_file,
},
{
name: "emitDeclarationsOnly",
type: "boolean",
category: Diagnostics.Advanced_Options,
description: Diagnostics.Only_emit_d_ts_declaration_files,
},
{
name: "sourceMap",
type: "boolean",
+9 -5
View File
@@ -4,7 +4,7 @@
namespace ts {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
export const versionMajorMinor = "2.7";
export const versionMajorMinor = "2.8";
/** The version of the TypeScript compiler release */
export const version = `${versionMajorMinor}.0`;
}
@@ -16,6 +16,10 @@ namespace ts {
// Update: We also consider a path like `C:\foo.ts` "relative" because we do not search for it in `node_modules` or treat it as an ambient module.
return pathIsRelative(moduleName) || isRootedDiskPath(moduleName);
}
export function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[] {
return sortAndDeduplicate(diagnostics, compareDiagnostics);
}
}
/* @internal */
@@ -340,6 +344,10 @@ namespace ts {
return false;
}
export function arraysEqual<T>(a: ReadonlyArray<T>, b: ReadonlyArray<T>, equalityComparer: EqualityComparer<T> = equateValues): boolean {
return a.length === b.length && a.every((x, i) => equalityComparer(x, b[i]));
}
export function indexOfAnyCharCode(text: string, charCodes: ReadonlyArray<number>, start?: number): number {
for (let i = start || 0; i < text.length; i++) {
if (contains(charCodes, text.charCodeAt(i))) {
@@ -1897,10 +1905,6 @@ namespace ts {
return text1 ? Comparison.GreaterThan : Comparison.LessThan;
}
export function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[] {
return sortAndDeduplicate(diagnostics, compareDiagnostics);
}
export function normalizeSlashes(path: string): string {
return path.replace(/\\/g, "/");
}
+4
View File
@@ -2807,6 +2807,10 @@
"category": "Message",
"code": 6013
},
"Only emit '.d.ts' declaration files.": {
"category": "Message",
"code": 6014
},
"Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'.": {
"category": "Message",
"code": 6015
+1 -1
View File
@@ -136,7 +136,7 @@ namespace ts {
function emitSourceFileOrBundle({ jsFilePath, sourceMapFilePath, declarationFilePath }: EmitFileNames, sourceFileOrBundle: SourceFile | Bundle) {
// Make sure not to write js file and source map file if any of them cannot be written
if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) {
if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit && !compilerOptions.emitDeclarationsOnly) {
if (!emitOnlyDtsFiles) {
printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle);
}
+13 -1
View File
@@ -2201,6 +2201,16 @@ namespace ts {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs"));
}
if (options.emitDeclarationsOnly) {
if (!options.declaration) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDeclarationsOnly", "declarations");
}
if (options.noEmit) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationsOnly", "noEmit");
}
}
if (options.emitDecoratorMetadata &&
!options.experimentalDecorators) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
@@ -2223,7 +2233,9 @@ namespace ts {
const emitHost = getEmitHost();
const emitFilesSeen = createMap<true>();
forEachEmittedFile(emitHost, (emitFileNames) => {
verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen);
if (!options.emitDeclarationsOnly) {
verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen);
}
verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen);
});
}
+4 -1
View File
@@ -335,7 +335,10 @@ namespace ts {
/* @internal */
export function computePositionOfLineAndCharacter(lineStarts: ReadonlyArray<number>, line: number, character: number, debugText?: string): number {
Debug.assert(line >= 0 && line < lineStarts.length);
if (line < 0 || line >= lineStarts.length) {
Debug.fail(`Bad line number. Line: ${line}, lineStarts.length: ${lineStarts.length} , line map is correct? ${debugText !== undefined ? arraysEqual(lineStarts, computeLineStarts(debugText)) : "unknown"}`);
}
const res = lineStarts[line] + character;
if (line < lineStarts.length - 1) {
Debug.assert(res < lineStarts[line + 1]);
+24 -6
View File
@@ -126,10 +126,32 @@ namespace ts {
const _fs = require("fs");
const _path = require("path");
const _os = require("os");
const _crypto = require("crypto");
// crypto can be absent on reduced node installations
let _crypto: any;
try {
_crypto = require("crypto");
}
catch {
_crypto = undefined;
}
const useNonPollingWatchers = process.env.TSC_NONPOLLING_WATCHER;
/**
* djb2 hashing algorithm
* http://www.cse.yorku.ca/~oz/hash.html
*/
function generateDjb2Hash(data: string): string {
const chars = data.split("").map(str => str.charCodeAt(0));
return `${chars.reduce((prev, curr) => ((prev << 5) + prev) + curr, 5381)}`;
}
function createMD5HashUsingNativeCrypto(data: string) {
const hash = _crypto.createHash("md5");
hash.update(data);
return hash.digest("hex");
}
function createWatchedFileSet() {
const dirWatchers = createMap<DirectoryWatcher>();
// One file can have multiple watchers
@@ -493,11 +515,7 @@ namespace ts {
return undefined;
}
},
createHash(data) {
const hash = _crypto.createHash("md5");
hash.update(data);
return hash.digest("hex");
},
createHash: _crypto ? createMD5HashUsingNativeCrypto : generateDjb2Hash,
getMemoryUsage() {
if (global.gc) {
global.gc();
+1 -1
View File
@@ -148,7 +148,7 @@ namespace ts {
}
function visitLabeledStatement(node: LabeledStatement) {
if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) {
if (enclosingFunctionFlags & FunctionFlags.Async) {
const statement = unwrapInnermostStatementOfLabel(node);
if (statement.kind === SyntaxKind.ForOfStatement && (<ForOfStatement>statement).awaitModifier) {
return visitForOfStatement(<ForOfStatement>statement, node);
+1
View File
@@ -3967,6 +3967,7 @@ namespace ts {
/** configFile is set as non enumerable property so as to avoid checking of json source files */
/* @internal */ readonly configFile?: JsonSourceFile;
declaration?: boolean;
emitDeclarationsOnly?: boolean;
declarationDir?: string;
/* @internal */ diagnostics?: boolean;
/* @internal */ extendedDiagnostics?: boolean;
+5
View File
@@ -599,6 +599,11 @@ namespace ts {
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3);
}
export function createDiagnosticForNodeArray(sourceFile: SourceFile, nodes: NodeArray<Node>, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): Diagnostic {
const start = skipTrivia(sourceFile.text, nodes.pos);
return createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2, arg3);
}
export function createDiagnosticForNodeInSourceFile(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): Diagnostic {
const span = getErrorSpanForNode(sourceFile, node);
return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3);
+3 -3
View File
@@ -68,7 +68,7 @@ namespace ts {
const host: ParseConfigFileHost = <any>system;
host.onConfigFileDiagnostic = reportDiagnostic;
host.onUnRecoverableConfigFileDiagnostic = diagnostic => reportUnrecoverableDiagnostic(sys, reportDiagnostic, diagnostic);
const result = parseConfigFile(configFileName, optionsToExtend, host);
const result = getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host);
host.onConfigFileDiagnostic = undefined;
host.onUnRecoverableConfigFileDiagnostic = undefined;
return result;
@@ -77,7 +77,7 @@ namespace ts {
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
export function parseConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost): ParsedCommandLine | undefined {
export function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost): ParsedCommandLine | undefined {
let configFileText: string;
try {
configFileText = host.readFile(configFileName);
@@ -791,7 +791,7 @@ namespace ts {
}
function parseConfigFile() {
const configParseResult = ts.parseConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost);
const configParseResult = ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost);
rootFileNames = configParseResult.fileNames;
compilerOptions = configParseResult.options;
configFileSpecs = configParseResult.configFileSpecs;
+2 -2
View File
@@ -131,13 +131,13 @@ function removeExpectedErrors(errors: string, cwd: string): string {
function isUnexpectedError(cwd: string) {
return (error: string[]) => {
ts.Debug.assertGreaterThanOrEqual(error.length, 1);
const match = error[0].match(/(.+\.ts)\((\d+),\d+\): error TS/);
const match = error[0].match(/(.+\.tsx?)\((\d+),\d+\): error TS/);
if (!match) {
return true;
}
const [, errorFile, lineNumberString] = match;
const lines = fs.readFileSync(path.join(cwd, errorFile), { encoding: "utf8" }).split("\n");
const lineNumber = parseInt(lineNumberString);
const lineNumber = parseInt(lineNumberString) - 1;
ts.Debug.assertGreaterThanOrEqual(lineNumber, 0);
ts.Debug.assertLessThan(lineNumber, lines.length);
const previousLine = lineNumber - 1 > 0 ? lines[lineNumber - 1] : "";
+17 -34
View File
@@ -24,7 +24,7 @@ namespace FourSlash {
ts.disableIncrementalParsing = false;
// Represents a parsed source file with metadata
export interface FourSlashFile {
interface FourSlashFile {
// The contents of the file (with markers, etc stripped out)
content: string;
fileName: string;
@@ -35,7 +35,7 @@ namespace FourSlash {
}
// Represents a set of parsed source files and options
export interface FourSlashData {
interface FourSlashData {
// Global options (name/value pairs)
globalOptions: Harness.TestCaseParser.CompilerSettings;
@@ -60,7 +60,7 @@ namespace FourSlash {
export interface Marker {
fileName: string;
position: number;
data?: any;
data?: {};
}
export interface Range {
@@ -90,21 +90,6 @@ namespace FourSlash {
end: number;
}
export import IndentStyle = ts.IndentStyle;
const entityMap = ts.createMapFromTemplate({
"&": "&amp;",
"\"": "&quot;",
"'": "&#39;",
"/": "&#47;",
"<": "&lt;",
">": "&gt;"
});
export function escapeXmlAttributeValue(s: string) {
return s.replace(/[&<>"'\/]/g, ch => entityMap.get(ch));
}
// Name of testcase metadata including ts.CompilerOptions properties that will be used by globalOptions
// To add additional option, add property into the testOptMetadataNames, refer the property in either globalMetadataNames or fileMetadataNames
// Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data
@@ -1083,7 +1068,7 @@ namespace FourSlash {
for (const reference of expectedReferences) {
const { fileName, start, end } = reference;
if (reference.marker && reference.marker.data) {
const { isWriteAccess, isDefinition } = reference.marker.data;
const { isWriteAccess, isDefinition } = reference.marker.data as { isWriteAccess?: boolean, isDefinition?: boolean };
this.verifyReferencesWorker(actualReferences, fileName, start, end, isWriteAccess, isDefinition);
}
else {
@@ -1112,7 +1097,16 @@ namespace FourSlash {
}
const fullExpected = ts.map<FourSlashInterface.ReferenceGroup, ReferenceGroupJson>(parts, ({ definition, ranges }) => ({
definition: typeof definition === "string" ? definition : { ...definition, range: textSpanFromRange(definition.range) },
references: ranges.map(rangeToReferenceEntry),
references: ranges.map<ts.ReferenceEntry>(r => {
const { isWriteAccess = false, isDefinition = false, isInString } = (r.marker && r.marker.data || {}) as { isWriteAccess?: boolean, isDefinition?: boolean, isInString?: true };
return {
isWriteAccess,
isDefinition,
fileName: r.fileName,
textSpan: textSpanFromRange(r),
...(isInString ? { isInString: true } : undefined),
};
}),
}));
for (const startRange of toArray(startRanges)) {
@@ -1126,15 +1120,6 @@ namespace FourSlash {
});
this.assertObjectsEqual(fullActual, fullExpected);
}
function rangeToReferenceEntry(r: Range): ts.ReferenceEntry {
const { isWriteAccess, isDefinition, isInString } = (r.marker && r.marker.data) || { isWriteAccess: false, isDefinition: false, isInString: undefined };
const result: ts.ReferenceEntry = { fileName: r.fileName, textSpan: textSpanFromRange(r), isWriteAccess: !!isWriteAccess, isDefinition: !!isDefinition };
if (isInString !== undefined) {
result.isInString = isInString;
}
return result;
}
}
public verifyNoReferences(markerNameOrRange?: string | Range) {
@@ -2591,12 +2576,10 @@ Actual: ${stringify(fullActual)}`);
actualTextArray.push(text);
scriptInfo.updateContent(originalContent);
}
const sortedExpectedArray = expectedTextArray.sort();
const sortedActualArray = actualTextArray.sort();
if (sortedExpectedArray.length !== sortedActualArray.length) {
this.raiseError(`Expected ${sortedExpectedArray.length} import fixes, got ${sortedActualArray.length}`);
if (expectedTextArray.length !== actualTextArray.length) {
this.raiseError(`Expected ${expectedTextArray.length} import fixes, got ${actualTextArray.length}`);
}
ts.zipWith(sortedExpectedArray, sortedActualArray, (expected, actual, index) => {
ts.zipWith(expectedTextArray, actualTextArray, (expected, actual, index) => {
if (expected !== actual) {
this.raiseError(`Import fix at index ${index} doesn't match.\n${showTextDiff(expected, actual)}`);
}
+11 -3
View File
@@ -1275,8 +1275,16 @@ namespace Harness {
options: ts.CompilerOptions,
// Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file
currentDirectory: string): DeclarationCompilationContext | undefined {
if (options.declaration && result.diagnostics.length === 0 && result.dts.size !== result.js.size) {
throw new Error("There were no errors and declFiles generated did not match number of js files generated");
if (options.declaration && result.diagnostics.length === 0) {
if (options.emitDeclarationsOnly) {
if (result.js.size > 0 || result.dts.size === 0) {
throw new Error("Only declaration files should be generated when emitDeclarationsOnly:true");
}
}
else if (result.dts.size !== result.js.size) {
throw new Error("There were no errors and declFiles generated did not match number of js files generated");
}
}
const declInputFiles: TestFile[] = [];
@@ -1664,7 +1672,7 @@ namespace Harness {
}
export function doJsEmitBaseline(baselinePath: string, header: string, options: ts.CompilerOptions, result: compiler.CompilationResult, tsConfigFiles: ReadonlyArray<Harness.Compiler.TestFile>, toBeCompiled: ReadonlyArray<Harness.Compiler.TestFile>, otherFiles: ReadonlyArray<Harness.Compiler.TestFile>, harnessSettings: Harness.TestCaseParser.CompilerSettings) {
if (!options.noEmit && result.js.size === 0 && result.diagnostics.length === 0) {
if (!options.noEmit && !options.emitDeclarationsOnly && result.js.size === 0 && result.diagnostics.length === 0) {
throw new Error("Expected at least one js file to be emitted or at least one error to be created.");
}
@@ -273,6 +273,13 @@ let i: I = [#|{ a: 1 }|];
const myObj: { member(x: number, y: string): void } = {
member: [#|(x, y) => x + y|],
}
`);
testExtractConstant("extractConstant_CaseClauseExpression", `
switch (1) {
case [#|1|]:
break;
}
`);
});
+52
View File
@@ -365,6 +365,58 @@ switch (x) {
refactor.extractSymbol.Messages.cannotExtractRange.message
]);
testExtractRangeFailed("extractRangeFailed14",
`
switch(1) {
case [#|1:
break;|]
}
`,
[
refactor.extractSymbol.Messages.cannotExtractRange.message
]);
testExtractRangeFailed("extractRangeFailed15",
`
switch(1) {
case [#|1:
break|];
}
`,
[
refactor.extractSymbol.Messages.cannotExtractRange.message
]);
// Documentation only - it would be nice if the result were [$|1|]
testExtractRangeFailed("extractRangeFailed16",
`
switch(1) {
[#|case 1|]:
break;
}
`,
[
refactor.extractSymbol.Messages.cannotExtractRange.message
]);
// Documentation only - it would be nice if the result were [$|1|]
testExtractRangeFailed("extractRangeFailed17",
`
switch(1) {
[#|case 1:|]
break;
}
`,
[
refactor.extractSymbol.Messages.cannotExtractRange.message
]);
testExtractRangeFailed("extractRangeFailed18",
`[#|{ 1;|] }`,
[
refactor.extractSymbol.Messages.cannotExtractRange.message
]);
testExtractRangeFailed("extract-method-not-for-token-expression-statement", `[#|a|]`, [refactor.extractSymbol.Messages.cannotExtractIdentifier.message]);
});
}
+42 -2
View File
@@ -1388,11 +1388,11 @@ namespace ts.projectSystem {
service.checkNumberOfProjects({ externalProjects: 1 });
checkProjectActualFiles(service.externalProjects[0], [f1.path, f2.path, fakes.FakeServerHost.libPath]);
const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
assert.isTrue(completions1.entries.some(e => e.name === "somelongname"), "should contain 'somelongname'");
service.closeClientFile(f2.path);
const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
assert.isFalse(completions2.entries.some(e => e.name === "somelongname"), "should not contain 'somelongname'");
const sf2 = service.externalProjects[0].getLanguageService().getProgram().getSourceFile(f2.path);
assert.equal(sf2.text, "");
@@ -2875,6 +2875,7 @@ namespace ts.projectSystem {
watchedRecursiveDirectories.push(`${root}/a/b/src`, `${root}/a/b/node_modules`);
host.checkWatchedDirectories(watchedRecursiveDirectories, /*recursive*/ true);
});
it("Properly handle Windows-style outDir", () => {
const configFile: FileOrFolder = {
path: "C:\\a\\tsconfig.json",
@@ -2900,6 +2901,45 @@ namespace ts.projectSystem {
const options = project.getCompilerOptions();
assert.equal(options.outDir, "C:/a/b", "");
});
it("dynamic file without external project", () => {
const file: FileOrFolder = {
path: "^walkThroughSnippet:/Users/UserName/projects/someProject/out/someFile#1.js",
content: "var x = 10;"
};
const host = createServerHost([], { dos: true, lib: true });
const projectService = createProjectService(host);
projectService.setCompilerOptionsForInferredProjects({
module: ModuleKind.CommonJS,
allowJs: true,
allowSyntheticDefaultImports: true,
allowNonTsExtensions: true
});
projectService.openClientFile(file.path, file.content);
projectService.checkNumberOfProjects({ inferredProjects: 1 });
const project = projectService.inferredProjects[0];
checkProjectRootFiles(project, [file.path]);
checkProjectActualFiles(project, [file.path, fakes.FakeServerHost.dosLibPath]);
assert.strictEqual(projectService.getDefaultProjectForFile(server.toNormalizedPath(file.path), /*ensureProject*/ true), project);
const indexOfX = file.content.indexOf("x");
assert.deepEqual(project.getLanguageService(/*ensureSynchronized*/ true).getQuickInfoAtPosition(file.path, indexOfX), {
kind: ScriptElementKind.variableElement,
kindModifiers: "",
textSpan: { start: indexOfX, length: 1 },
displayParts: [
{ text: "var", kind: "keyword" },
{ text: " ", kind: "space" },
{ text: "x", kind: "localName" },
{ text: ":", kind: "punctuation" },
{ text: " ", kind: "space" },
{ text: "number", kind: "keyword" }
],
documentation: [],
tags: []
});
});
});
describe("Proper errors", () => {
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -573,6 +573,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[其余元素不能具有属性名。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3369,15 +3378,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[提取符号]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3564,6 +3564,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[在“{0}”找到了 "package.json"。包 ID 为“{1}”。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6594,11 +6603,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[指定要在编译中包括的库文件: ]]></Val>
<Val><![CDATA[指定要在编译中包括的库文件。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -573,6 +573,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[REST 元素不得有屬性名稱。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3369,15 +3378,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[解壓縮符號]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3564,6 +3564,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[於 '{0}' 找到 'package.json'。套件識別碼為 '{1}'。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6594,11 +6603,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[指定編譯內要包含的程式庫檔: ]]></Val>
<Val><![CDATA[請指定要併入編譯中的程式庫檔案。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -19,7 +19,7 @@
<Cmt Name="ManifestData" />
<Cmt Name="Mnemonic" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
<Cmt Name="UIType" />
<Cmt Name="UTSData" />
<Cmt Name="UTSUI" />
@@ -582,6 +582,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Element rest nemůže mít název vlastnosti.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3378,15 +3387,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Extrahovat symbol]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3573,6 +3573,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[V {0} se našel soubor package.json. ID balíčku je {1}.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6603,11 +6612,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Zadejte soubory knihovny, které se mají zahrnout do kompilace: ]]></Val>
<Val><![CDATA[Zadejte soubory knihovny, které se mají zahrnout do kompilace.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -573,6 +573,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ein rest-Element darf keinen Eigenschaftennamen aufweisen.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3366,15 +3375,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Symbol extrahieren]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3561,6 +3561,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA["Package.json" unter "{0}" gefunden. Paket-ID: "{1}".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6585,11 +6594,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Geben Sie Bibliotheksdateien an, die in die Kompilierung eingeschlossen werden sollen: ]]></Val>
<Val><![CDATA[Geben Sie Bibliotheksdateien an, die in die Kompilierung eingeschlossen werden sollen.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -19,7 +19,7 @@
<Cmt Name="ManifestData" />
<Cmt Name="Mnemonic" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
<Cmt Name="UIType" />
<Cmt Name="UTSData" />
<Cmt Name="UTSUI" />
@@ -582,6 +582,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Un elemento rest no puede tener un nombre de propiedad.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3378,15 +3387,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Extraer el símbolo]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3573,6 +3573,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Se encontró "package.json" en "{0}". El identificador de paquete es "{1}".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6603,11 +6612,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Especifique archivos de biblioteca para incluirlos en la compilación: ]]></Val>
<Val><![CDATA[Especifique los archivos de biblioteca que se van a incluir en la compilación.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -19,7 +19,7 @@
<Cmt Name="ManifestData" />
<Cmt Name="Mnemonic" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
<Cmt Name="UIType" />
<Cmt Name="UTSData" />
<Cmt Name="UTSUI" />
@@ -582,6 +582,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Un élément rest ne peut pas avoir de nom de propriété.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3378,15 +3387,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Extraire le symbole]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3573,6 +3573,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['package.json' trouvé sur '{0}'. L'ID de package est '{1}'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6603,11 +6612,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Spécifiez les fichiers bibliothèques à inclure dans la compilation : ]]></Val>
<Val><![CDATA[Spécifiez les fichiers bibliothèques à inclure dans la compilation.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -573,6 +573,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Un elemento rest non può contenere un nome proprietà.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3369,15 +3378,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Estrarre il simbolo]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3564,6 +3564,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Il file 'package.json' è stato trovato in '{0}'. L'ID pacchetto è '{1}'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6594,11 +6603,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Specifica i file di libreria da includere nella compilazione: ]]></Val>
<Val><![CDATA[Specificare i file di libreria da includere nella compilazione.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -573,6 +573,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[rest 要素にプロパティ名を指定することはできません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3369,15 +3378,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[シンボルの抽出]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3564,6 +3564,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' で 'package.json' が見つかりました。パッケージ ID は、'{1}' です。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6594,11 +6603,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[コンパイルに含めるライブラリ ファイルを指定します: ]]></Val>
<Val><![CDATA[コンパイルに含めるライブラリ ファイルを指定します。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -573,6 +573,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[rest 요소에는 속성 이름을 사용할 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3369,15 +3378,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[기호 추출]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3564,6 +3564,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}'에서 'package.json'을 찾았습니다. 패키지 ID는 '{1}'입니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6594,11 +6603,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[컴파일에 포함할 라이브러리 파일 지정: ]]></Val>
<Val><![CDATA[컴파일에 포함할 라이브러리 파일을 지정합니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7,7 +7,7 @@
<Cmt Name="Dev" />
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -566,6 +566,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Element rest nie może mieć nazwy właściwości.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3359,15 +3368,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Wyodrębnij symbol]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3554,6 +3554,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Znaleziono plik „package.json” w lokalizacji „{0}”. Identyfikator pakietu to „{1}”.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6578,11 +6587,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Określ pliki biblioteki do uwzględnienia w kompilacji: ]]></Val>
<Val><![CDATA[Określ pliki biblioteki do uwzględnienia w kompilacji.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7,7 +7,7 @@
<Cmt Name="Dev" />
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -566,6 +566,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Um elemento restante não pode ter um nome de propriedade.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3359,15 +3368,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Extrair símbolo]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3554,6 +3554,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['package.json' encontrado em '{0}'. A ID do pacote é '{1}'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6578,11 +6587,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Especifique os arquivos de biblioteca a serem incluídos na compilação: ]]></Val>
<Val><![CDATA[Especifique os arquivos de biblioteca a serem incluídos na compilação.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -13,7 +13,7 @@
<Cmt Name="Dev" />
<Cmt Name="LcxAdmin" />
<Cmt Name="Note" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -572,6 +572,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Элемент rest не может иметь имя свойства.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3368,15 +3377,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Извлечь символ]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3563,6 +3563,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Найден "package.json" в "{0}". Идентификатор пакета: "{1}".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6593,11 +6602,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Укажите файлы библиотеки для включения в компиляцию: ]]></Val>
<Val><![CDATA[Укажите файлы библиотек для включения в компиляцию.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7,7 +7,7 @@
<Cmt Name="Dev" />
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Rccx" />
<Cmt Name="RCCX" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -566,6 +566,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_a_property_name_2566" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have a property name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Rest öğesinin özellik adı olamaz.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_rest_element_cannot_have_an_initializer_1186" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A rest element cannot have an initializer.]]></Val>
@@ -3362,15 +3371,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_symbol_95003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract symbol]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Sembolü ayıkla]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Extract_to_0_in_1_95004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Extract to {0} in {1}]]></Val>
@@ -3557,6 +3557,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_Package_ID_is_1_6190" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'. Package ID is '{1}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' konumunda 'package.json' bulundu. Paket kimliği '{1}'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.]]></Val>
@@ -6587,11 +6596,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_Colon_6079" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Specify_library_files_to_be_included_in_the_compilation_6079" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Specify library files to be included in the compilation: ]]></Val>
<Val><![CDATA[Specify library files to be included in the compilation.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Derlemeye dahil edilecek kitaplık dosyalarını belirtin: ]]></Val>
<Val><![CDATA[Derlemeye dahil edilecek kitaplık dosyalarını belirtin.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
+2 -2
View File
@@ -902,7 +902,7 @@ namespace ts.server {
const project = this.getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) ||
this.getOrCreateSingleInferredProjectIfEnabled() ||
this.createInferredProject(getDirectoryPath(info.path));
this.createInferredProject(info.isDynamic ? this.currentDirectory : getDirectoryPath(info.path));
project.addRoot(info);
project.updateGraph();
@@ -1659,7 +1659,7 @@ namespace ts.server {
}
private getOrCreateInferredProjectForProjectRootPathIfEnabled(info: ScriptInfo, projectRootPath: NormalizedPath | undefined): InferredProject | undefined {
if (!this.useInferredProjectPerProjectRoot) {
if (info.isDynamic || !this.useInferredProjectPerProjectRoot) {
return undefined;
}
+1 -1
View File
@@ -196,7 +196,7 @@ namespace ts.server {
/*@internal*/
export function isDynamicFileName(fileName: NormalizedPath) {
return getBaseFileName(fileName)[0] === "^";
return fileName[0] === "^" || getBaseFileName(fileName)[0] === "^";
}
export class ScriptInfo {
+25 -29
View File
@@ -1,8 +1,8 @@
/* @internal */
namespace ts.codefix {
const fixId = "disableJsDiagnostics";
const errorCodes = mapDefined(Object.keys(Diagnostics), key => {
const diag = (Diagnostics as MapLike<DiagnosticMessage>)[key];
const errorCodes = mapDefined(Object.keys(Diagnostics) as ReadonlyArray<keyof typeof Diagnostics>, key => {
const diag = Diagnostics[key];
return diag.category === DiagnosticCategory.Error ? diag.code : undefined;
});
@@ -19,33 +19,35 @@ namespace ts.codefix {
return [{
description: getLocaleSpecificMessage(Diagnostics.Ignore_this_error_message),
changes: [createFileTextChanges(sourceFile.fileName, [getIgnoreCommentLocationForLocation(sourceFile, span.start, newLineCharacter)])],
changes: [createFileTextChanges(sourceFile.fileName, [getIgnoreCommentLocationForLocation(sourceFile, span.start, newLineCharacter).change])],
fixId,
},
{
description: getLocaleSpecificMessage(Diagnostics.Disable_checking_for_this_file),
changes: [createFileTextChanges(sourceFile.fileName, [{
span: {
start: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.pos : 0,
length: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.end - sourceFile.checkJsDirective.pos : 0
},
newText: `// @ts-nocheck${newLineCharacter}`
}])],
changes: [createFileTextChanges(sourceFile.fileName, [
createTextChange(sourceFile.checkJsDirective ? createTextSpanFromBounds(sourceFile.checkJsDirective.pos, sourceFile.checkJsDirective.end) : createTextSpan(0, 0), `// @ts-nocheck${newLineCharacter}`),
])],
// fixId unnecessary because adding `// @ts-nocheck` even once will ignore every error in the file.
fixId: undefined,
}];
},
fixIds: [fixId], // No point applying as a group, doing it once will fix all errors
getAllCodeActions: context => codeFixAllWithTextChanges(context, errorCodes, (changes, err) => {
if (err.start !== undefined) {
changes.push(getIgnoreCommentLocationForLocation(err.file!, err.start, getNewLineOrDefaultFromHost(context.host, context.formatContext.options)));
}
}),
fixIds: [fixId],
getAllCodeActions: context => {
const seenLines = createMap<true>(); // Only need to add `// @ts-ignore` for a line once.
return codeFixAllWithTextChanges(context, errorCodes, (changes, err) => {
if (err.start !== undefined) {
const { lineNumber, change } = getIgnoreCommentLocationForLocation(err.file!, err.start, getNewLineOrDefaultFromHost(context.host, context.formatContext.options));
if (addToSeen(seenLines, lineNumber)) {
changes.push(change);
}
}
});
},
});
function getIgnoreCommentLocationForLocation(sourceFile: SourceFile, position: number, newLineCharacter: string): TextChange {
const { line } = getLineAndCharacterOfPosition(sourceFile, position);
const lineStartPosition = getStartPositionOfLine(line, sourceFile);
function getIgnoreCommentLocationForLocation(sourceFile: SourceFile, position: number, newLineCharacter: string): { lineNumber: number, change: TextChange } {
const { line: lineNumber } = getLineAndCharacterOfPosition(sourceFile, position);
const lineStartPosition = getStartPositionOfLine(lineNumber, sourceFile);
const startPosition = getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition);
// First try to see if we can put the '// @ts-ignore' on the previous line.
@@ -54,19 +56,13 @@ namespace ts.codefix {
// if so, we do not want to separate the node from its comment if we can.
if (!isInComment(sourceFile, startPosition) && !isInString(sourceFile, startPosition) && !isInTemplateString(sourceFile, startPosition)) {
const token = getTouchingToken(sourceFile, startPosition, /*includeJsDocComment*/ false);
const tokenLeadingCommnets = getLeadingCommentRangesOfNode(token, sourceFile);
if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) {
return {
span: { start: startPosition, length: 0 },
newText: `// @ts-ignore${newLineCharacter}`
};
const tokenLeadingComments = getLeadingCommentRangesOfNode(token, sourceFile);
if (!tokenLeadingComments || !tokenLeadingComments.length || tokenLeadingComments[0].pos >= startPosition) {
return { lineNumber, change: createTextChangeFromStartLength(startPosition, 0, `// @ts-ignore${newLineCharacter}`) };
}
}
// If all fails, add an extra new line immediately before the error span.
return {
span: { start: position, length: 0 },
newText: `${position === startPosition ? "" : newLineCharacter}// @ts-ignore${newLineCharacter}`
};
return { lineNumber, change: createTextChangeFromStartLength(position, 0, `${position === startPosition ? "" : newLineCharacter}// @ts-ignore${newLineCharacter}`) };
}
}
+1 -1
View File
@@ -50,7 +50,7 @@ namespace ts.codefix {
}
function createChange(declaration: TypeNode, sourceFile: SourceFile, newText: string): TextChange {
return { span: createTextSpanFromBounds(declaration.getStart(sourceFile), declaration.getEnd()), newText };
return createTextChange(createTextSpanFromNode(declaration, sourceFile), newText);
}
function typeString(type: Type, checker: TypeChecker): string {
+1 -1
View File
@@ -390,7 +390,7 @@ namespace ts.codefix {
In this case we should prefer using the relative path "../a" instead of the baseUrl path "foo/a".
*/
const pathFromSourceToBaseUrl = getRelativePath(baseUrl, sourceDirectory, getCanonicalFileName);
const relativeFirst = getRelativePathNParents(pathFromSourceToBaseUrl) < getRelativePathNParents(relativePath);
const relativeFirst = getRelativePathNParents(relativePath) < getRelativePathNParents(pathFromSourceToBaseUrl);
return relativeFirst ? [relativePath, importRelativeToBaseUrl] : [importRelativeToBaseUrl, relativePath];
}));
// Only return results for the re-export with the shortest possible path (and also give the other path even if that's long.)
+1 -1
View File
@@ -191,7 +191,7 @@ namespace ts.codefix {
function makeChange(declaration: Declaration, start: number, type: Type | undefined, program: Program): TextChange | undefined {
const typeString = type && typeToString(type, declaration, program.getTypeChecker());
return typeString === undefined ? undefined : { span: createTextSpan(start, 0), newText: `: ${typeString}` };
return typeString === undefined ? undefined : createTextChangeFromStartLength(start, 0, `: ${typeString}`);
}
function getReferences(token: PropertyName | Token<SyntaxKind.ConstructorKeyword>, sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): Identifier[] {
+70 -68
View File
@@ -20,7 +20,8 @@ namespace ts.Completions {
None,
ClassElementKeywords, // Keywords at class keyword
ConstructorParameterKeywords, // Keywords at constructor parameter
FunctionLikeBodyKeywords // Keywords at function like body
FunctionLikeBodyKeywords, // Keywords at function like body
TypeKeywords,
}
export function getCompletionsAtPosition(
@@ -77,7 +78,7 @@ namespace ts.Completions {
}
function completionInfoFromData(sourceFile: SourceFile, typeChecker: TypeChecker, compilerOptions: CompilerOptions, log: Log, completionData: CompletionData, includeInsertTextCompletions: boolean): CompletionInfo {
const { symbols, completionKind, isNewIdentifierLocation, location, propertyAccessToConvert, keywordFilters, symbolToOriginInfoMap, recommendedCompletion } = completionData;
const { symbols, completionKind, isNewIdentifierLocation, location, propertyAccessToConvert, keywordFilters, symbolToOriginInfoMap, recommendedCompletion, isJsxInitializer } = completionData;
if (sourceFile.languageVariant === LanguageVariant.JSX && location && location.parent && isJsxClosingElement(location.parent)) {
// In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,
@@ -98,7 +99,7 @@ namespace ts.Completions {
const entries: CompletionEntry[] = [];
if (isSourceFileJavaScript(sourceFile)) {
const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, includeInsertTextCompletions, propertyAccessToConvert, recommendedCompletion, symbolToOriginInfoMap);
const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, includeInsertTextCompletions, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target, entries);
}
else {
@@ -106,7 +107,7 @@ namespace ts.Completions {
return undefined;
}
getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, includeInsertTextCompletions, propertyAccessToConvert, recommendedCompletion, symbolToOriginInfoMap);
getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, includeInsertTextCompletions, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
}
// TODO add filter for keyword based on type/value/namespace and also location
@@ -166,6 +167,7 @@ namespace ts.Completions {
origin: SymbolOriginInfo | undefined,
recommendedCompletion: Symbol | undefined,
propertyAccessToConvert: PropertyAccessExpression | undefined,
isJsxInitializer: boolean,
includeInsertTextCompletions: boolean,
): CompletionEntry | undefined {
const info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind);
@@ -173,19 +175,27 @@ namespace ts.Completions {
return undefined;
}
const { name, needsConvertPropertyAccess } = info;
if (needsConvertPropertyAccess && !includeInsertTextCompletions) {
return undefined;
}
let insertText: string | undefined;
let replacementSpan: TextSpan | undefined;
if (kind === CompletionKind.Global && origin && origin.type === "this-type") {
insertText = needsConvertPropertyAccess ? `this["${name}"]` : `this.${name}`;
if (includeInsertTextCompletions) {
if (origin && origin.type === "this-type") {
insertText = needsConvertPropertyAccess ? `this["${name}"]` : `this.${name}`;
}
else if (needsConvertPropertyAccess) {
// TODO: GH#20619 Use configured quote style
insertText = `["${name}"]`;
replacementSpan = createTextSpanFromBounds(findChildOfKind(propertyAccessToConvert!, SyntaxKind.DotToken, sourceFile)!.getStart(sourceFile), propertyAccessToConvert!.name.end);
}
if (isJsxInitializer) {
if (insertText === undefined) insertText = name;
insertText = `{${insertText}}`;
}
}
else if (needsConvertPropertyAccess) {
// TODO: GH#20619 Use configured quote style
insertText = `["${name}"]`;
replacementSpan = createTextSpanFromBounds(findChildOfKind(propertyAccessToConvert!, SyntaxKind.DotToken, sourceFile)!.getStart(sourceFile), propertyAccessToConvert!.name.end);
if (insertText !== undefined && !includeInsertTextCompletions) {
return undefined;
}
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
@@ -234,6 +244,7 @@ namespace ts.Completions {
kind: CompletionKind,
includeInsertTextCompletions?: boolean,
propertyAccessToConvert?: PropertyAccessExpression | undefined,
isJsxInitializer?: boolean,
recommendedCompletion?: Symbol,
symbolToOriginInfoMap?: SymbolOriginInfoMap,
): Map<true> {
@@ -245,7 +256,7 @@ namespace ts.Completions {
const uniques = createMap<true>();
for (const symbol of symbols) {
const origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[getSymbolId(symbol)] : undefined;
const entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, includeInsertTextCompletions);
const entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, includeInsertTextCompletions);
if (!entry) {
continue;
}
@@ -482,6 +493,7 @@ namespace ts.Completions {
location: Node;
symbolToOriginInfoMap: SymbolOriginInfoMap;
previousToken: Node;
readonly isJsxInitializer: boolean;
}
function getSymbolCompletionFromEntryId(
typeChecker: TypeChecker,
@@ -500,7 +512,7 @@ namespace ts.Completions {
return { type: "request", request: completionData };
}
const { symbols, location, completionKind, symbolToOriginInfoMap, previousToken } = completionData;
const { symbols, location, completionKind, symbolToOriginInfoMap, previousToken, isJsxInitializer } = completionData;
// Find the symbol with the matching entry name.
// We don't need to perform character checks here because we're only comparing the
@@ -509,7 +521,7 @@ namespace ts.Completions {
return firstDefined<Symbol, SymbolCompletion>(symbols, (symbol): SymbolCompletion => { // TODO: Shouldn't need return type annotation (GH#12632)
const origin = symbolToOriginInfoMap[getSymbolId(symbol)];
const info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions.target, origin, completionKind);
return info && info.name === name && getSourceFromOrigin(origin) === source ? { type: "symbol" as "symbol", symbol, location, symbolToOriginInfoMap, previousToken } : undefined;
return info && info.name === name && getSourceFromOrigin(origin) === source ? { type: "symbol" as "symbol", symbol, location, symbolToOriginInfoMap, previousToken, isJsxInitializer } : undefined;
}) || { type: "none" };
}
@@ -565,7 +577,7 @@ namespace ts.Completions {
}
case "none": {
// Didn't find a symbol with this name. See if we can find a keyword instead.
if (some(getKeywordCompletions(KeywordCompletionFilters.None), c => c.name === name)) {
if (allKeywordsCompletions().some(c => c.name === name)) {
return {
name,
kind: ScriptElementKind.keyword,
@@ -677,11 +689,13 @@ namespace ts.Completions {
readonly symbolToOriginInfoMap: SymbolOriginInfoMap;
readonly recommendedCompletion: Symbol | undefined;
readonly previousToken: Node | undefined;
readonly isJsxInitializer: boolean;
}
type Request = { readonly kind: CompletionDataKind.JsDocTagName | CompletionDataKind.JsDocTag } | { readonly kind: CompletionDataKind.JsDocParameterName, tag: JSDocParameterTag };
const enum CompletionKind {
ObjectPropertyDeclaration,
/** Note that sometimes we access completions from global scope, but use "None" instead of this. See isGlobalCompletionScope. */
Global,
PropertyAccess,
MemberLike,
@@ -857,6 +871,7 @@ namespace ts.Completions {
let isRightOfDot = false;
let isRightOfOpenTag = false;
let isStartingCloseTag = false;
let isJsxInitializer = false;
let location = getTouchingPropertyName(sourceFile, position, insideJsDocTagTypeExpression); // TODO: GH#15853
if (contextToken) {
@@ -915,6 +930,10 @@ namespace ts.Completions {
location = contextToken;
}
break;
case SyntaxKind.JsxAttribute:
isJsxInitializer = previousToken.kind === SyntaxKind.EqualsToken;
break;
}
}
}
@@ -960,7 +979,7 @@ namespace ts.Completions {
log("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
const recommendedCompletion = previousToken && getRecommendedCompletion(previousToken, typeChecker);
return { kind: CompletionDataKind.Data, symbols, completionKind, propertyAccessToConvert, isNewIdentifierLocation, location, keywordFilters, symbolToOriginInfoMap, recommendedCompletion, previousToken };
return { kind: CompletionDataKind.Data, symbols, completionKind, propertyAccessToConvert, isNewIdentifierLocation, location, keywordFilters, symbolToOriginInfoMap, recommendedCompletion, previousToken, isJsxInitializer };
type JSDocTagWithTypeExpression = JSDocParameterTag | JSDocPropertyTag | JSDocReturnTag | JSDocTypeTag | JSDocTypedefTag;
@@ -1163,6 +1182,9 @@ namespace ts.Completions {
}
function filterGlobalCompletion(symbols: Symbol[]): void {
const isTypeCompletion = insideJsDocTagTypeExpression || !isContextTokenValueLocation(contextToken) && (isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
if (isTypeCompletion) keywordFilters = KeywordCompletionFilters.TypeKeywords;
filterMutate(symbols, symbol => {
if (!isSourceFile(location)) {
// export = /**/ here we want to get all meanings, so any symbol is ok
@@ -1170,19 +1192,14 @@ namespace ts.Completions {
return true;
}
// This is an alias, follow what it aliases
if (symbol && symbol.flags & SymbolFlags.Alias) {
symbol = typeChecker.getAliasedSymbol(symbol);
}
symbol = skipAlias(symbol, typeChecker);
// import m = /**/ <-- It can only access namespace (if typing import = x. this would get member symbols and not namespace)
if (isInRightSideOfInternalImportEqualsDeclaration(location)) {
return !!(symbol.flags & SymbolFlags.Namespace);
}
if (insideJsDocTagTypeExpression ||
(!isContextTokenValueLocation(contextToken) &&
(isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken)))) {
if (isTypeCompletion) {
// Its a type, but you can reach it by namespace.type as well
return symbolCanBeReferencedAtTypeLocation(symbol);
}
@@ -1199,7 +1216,7 @@ namespace ts.Completions {
contextToken.parent.kind === SyntaxKind.TypeQuery;
}
function isContextTokenTypeLocation(contextToken: Node) {
function isContextTokenTypeLocation(contextToken: Node): boolean {
if (contextToken) {
const parentKind = contextToken.parent.kind;
switch (contextToken.kind) {
@@ -1217,6 +1234,7 @@ namespace ts.Completions {
return parentKind === SyntaxKind.AsExpression;
}
}
return false;
}
function symbolCanBeReferencedAtTypeLocation(symbol: Symbol): boolean {
@@ -2112,13 +2130,13 @@ namespace ts.Completions {
const validIdentiferResult: CompletionEntryDisplayNameForSymbol = { name, needsConvertPropertyAccess: false };
if (isIdentifierText(name, target)) return validIdentiferResult;
switch (kind) {
case CompletionKind.None:
case CompletionKind.MemberLike:
return undefined;
case CompletionKind.ObjectPropertyDeclaration:
// TODO: GH#18169
return { name: JSON.stringify(name), needsConvertPropertyAccess: false };
case CompletionKind.PropertyAccess:
case CompletionKind.None:
case CompletionKind.Global:
// Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547
return name.charCodeAt(0) === CharacterCodes.space ? undefined : { name, needsConvertPropertyAccess: true };
@@ -2130,51 +2148,38 @@ namespace ts.Completions {
}
// A cache of completion entries for keywords, these do not change between sessions
const _keywordCompletions: CompletionEntry[][] = [];
function getKeywordCompletions(keywordFilter: KeywordCompletionFilters): CompletionEntry[] {
const completions = _keywordCompletions[keywordFilter];
if (completions) {
return completions;
const _keywordCompletions: ReadonlyArray<CompletionEntry>[] = [];
const allKeywordsCompletions: () => ReadonlyArray<CompletionEntry> = ts.memoize(() => {
const res: CompletionEntry[] = [];
for (let i = SyntaxKind.FirstKeyword; i <= SyntaxKind.LastKeyword; i++) {
res.push({
name: tokenToString(i),
kind: ScriptElementKind.keyword,
kindModifiers: ScriptElementKindModifier.none,
sortText: "0"
});
}
return _keywordCompletions[keywordFilter] = generateKeywordCompletions(keywordFilter);
type FilterKeywordCompletions = (entryName: string) => boolean;
function generateKeywordCompletions(keywordFilter: KeywordCompletionFilters): CompletionEntry[] {
return res;
});
function getKeywordCompletions(keywordFilter: KeywordCompletionFilters): ReadonlyArray<CompletionEntry> {
return _keywordCompletions[keywordFilter] || (_keywordCompletions[keywordFilter] = allKeywordsCompletions().filter(entry => {
const kind = stringToToken(entry.name);
switch (keywordFilter) {
case KeywordCompletionFilters.None:
return getAllKeywordCompletions();
// "undefined" is a global variable, so don't need a keyword completion for it.
return kind !== SyntaxKind.UndefinedKeyword;
case KeywordCompletionFilters.ClassElementKeywords:
return getFilteredKeywordCompletions(isClassMemberCompletionKeywordText);
return isClassMemberCompletionKeyword(kind);
case KeywordCompletionFilters.ConstructorParameterKeywords:
return getFilteredKeywordCompletions(isConstructorParameterCompletionKeywordText);
return isConstructorParameterCompletionKeyword(kind);
case KeywordCompletionFilters.FunctionLikeBodyKeywords:
return getFilteredKeywordCompletions(isFunctionLikeBodyCompletionKeywordText);
return isFunctionLikeBodyCompletionKeyword(kind);
case KeywordCompletionFilters.TypeKeywords:
return isTypeKeyword(kind);
default:
Debug.assertNever(keywordFilter);
return Debug.assertNever(keywordFilter);
}
}
function getAllKeywordCompletions() {
const allKeywordsCompletions: CompletionEntry[] = [];
for (let i = SyntaxKind.FirstKeyword; i <= SyntaxKind.LastKeyword; i++) {
// "undefined" is a global variable, so don't need a keyword completion for it.
if (i === SyntaxKind.UndefinedKeyword) continue;
allKeywordsCompletions.push({
name: tokenToString(i),
kind: ScriptElementKind.keyword,
kindModifiers: ScriptElementKindModifier.none,
sortText: "0"
});
}
return allKeywordsCompletions;
}
function getFilteredKeywordCompletions(filterFn: FilterKeywordCompletions) {
return filter(
getKeywordCompletions(KeywordCompletionFilters.None),
entry => filterFn(entry.name)
);
}
}));
}
function isClassMemberCompletionKeyword(kind: SyntaxKind) {
@@ -2222,15 +2227,12 @@ namespace ts.Completions {
case SyntaxKind.AbstractKeyword:
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
case SyntaxKind.UndefinedKeyword:
return false;
}
return true;
}
function isFunctionLikeBodyCompletionKeywordText(text: string) {
return isFunctionLikeBodyCompletionKeyword(stringToToken(text));
}
function isEqualityOperatorKind(kind: ts.SyntaxKind): kind is EqualityOperator {
switch (kind) {
case ts.SyntaxKind.EqualsEqualsEqualsToken:
+2 -6
View File
@@ -1078,19 +1078,15 @@ namespace ts.formatting {
trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange);
}
function newTextChange(start: number, len: number, newText: string): TextChange {
return { span: createTextSpan(start, len), newText };
}
function recordDelete(start: number, len: number) {
if (len) {
edits.push(newTextChange(start, len, ""));
edits.push(createTextChangeFromStartLength(start, len, ""));
}
}
function recordReplace(start: number, len: number, newText: string) {
if (len || newText) {
edits.push(newTextChange(start, len, newText));
edits.push(createTextChangeFromStartLength(start, len, newText));
}
}
+3
View File
@@ -321,6 +321,9 @@ namespace ts.formatting {
rule("NoSpaceAfterCloseBracket", SyntaxKind.CloseBracketToken, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], RuleAction.Delete),
rule("SpaceAfterSemicolon", SyntaxKind.SemicolonToken, anyToken, [isNonJsxSameLineTokenContext], RuleAction.Space),
// Remove extra space between for and await
rule("SpaceBetweenForAndAwaitKeyword", SyntaxKind.ForKeyword, SyntaxKind.AwaitKeyword, [isNonJsxSameLineTokenContext], RuleAction.Space),
// Add a space between statements. All keywords except (do,else,case) has open/close parens after them.
// So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any]
rule(
+22 -1
View File
@@ -510,11 +510,32 @@ namespace ts.FindAllReferences {
return undefined;
}
const sym = useLhsSymbol ? checker.getSymbolAtLocation((node.left as ts.PropertyAccessExpression).name) : symbol;
const sym = useLhsSymbol ? checker.getSymbolAtLocation(cast(node.left, isPropertyAccessExpression).name) : symbol;
// Better detection for GH#20803
if (sym && !(checker.getMergedSymbol(sym.parent).flags & SymbolFlags.Module)) {
Debug.fail(`Special property assignment kind does not have a module as its parent. Assignment is ${showSymbol(sym)}, parent is ${showSymbol(sym.parent)}`);
}
return sym && exportInfo(sym, kind);
}
}
function showSymbol(s: Symbol): string {
const decls = s.declarations.map(d => (ts as any).SyntaxKind[d.kind]).join(",");
const flags = showFlags(s.flags, (ts as any).SymbolFlags);
return `{ declarations: ${decls}, flags: ${flags} }`;
}
function showFlags(f: number, flags: any) {
const out = [];
for (let pow = 0; pow <= 30; pow++) {
const n = 1 << pow;
if (f & n) {
out.push(flags[n]);
}
}
return out.join("|");
}
function getImport(): ImportedSymbol | undefined {
const isImport = isNodeImport(node);
if (!isImport) return undefined;
+17
View File
@@ -235,6 +235,16 @@ namespace ts.refactor.extractSymbol {
break;
}
}
if (!statements.length) {
// https://github.com/Microsoft/TypeScript/issues/20559
// Ranges like [|case 1: break;|] will fail to populate `statements` because
// they will never find `start` in `start.parent.statements`.
// Consider: We could support ranges like [|case 1:|] by refining them to just
// the expression.
return { errors: [createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
}
return { targetRange: { range: statements, facts: rangeFacts, declarations } };
}
@@ -1321,6 +1331,13 @@ namespace ts.refactor.extractSymbol {
}
prevStatement = statement;
}
if (!prevStatement && isCaseClause(curr)) {
// We must have been in the expression of the case clause.
Debug.assert(isSwitchStatement(curr.parent.parent));
return curr.parent.parent;
}
// There must be at least one statement since we started in one.
Debug.assert(prevStatement !== undefined);
return prevStatement;
+1 -4
View File
@@ -620,10 +620,7 @@ namespace ts.textChanges {
const sourceFile = changesInFile[0].sourceFile;
const fileTextChanges: FileTextChanges = { fileName: sourceFile.fileName, textChanges: [] };
for (const c of ChangeTracker.normalize(changesInFile)) {
fileTextChanges.textChanges.push({
span: this.computeSpan(c, sourceFile),
newText: this.computeNewText(c, sourceFile)
});
fileTextChanges.textChanges.push(createTextChange(this.computeSpan(c, sourceFile), this.computeNewText(c, sourceFile)));
}
fileChangesList.push(fileTextChanges);
});
+12
View File
@@ -1067,15 +1067,27 @@ namespace ts {
return createTextSpanFromBounds(range.pos, range.end);
}
export function createTextChangeFromStartLength(start: number, length: number, newText: string): TextChange {
return createTextChange(createTextSpan(start, length), newText);
}
export function createTextChange(span: TextSpan, newText: string): TextChange {
return { span, newText };
}
export const typeKeywords: ReadonlyArray<SyntaxKind> = [
SyntaxKind.AnyKeyword,
SyntaxKind.BooleanKeyword,
SyntaxKind.KeyOfKeyword,
SyntaxKind.NeverKeyword,
SyntaxKind.NullKeyword,
SyntaxKind.NumberKeyword,
SyntaxKind.ObjectKeyword,
SyntaxKind.StringKeyword,
SyntaxKind.SymbolKeyword,
SyntaxKind.VoidKeyword,
SyntaxKind.UndefinedKeyword,
SyntaxKind.UniqueKeyword,
];
export function isTypeKeyword(kind: SyntaxKind): boolean {
+3 -1
View File
@@ -2266,6 +2266,7 @@ declare namespace ts {
charset?: string;
checkJs?: boolean;
declaration?: boolean;
emitDeclarationsOnly?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
downlevelIteration?: boolean;
@@ -2808,12 +2809,13 @@ declare namespace ts {
}
}
declare namespace ts {
const versionMajorMinor = "2.7";
const versionMajorMinor = "2.8";
/** The version of the TypeScript compiler release */
const version: string;
}
declare namespace ts {
function isExternalModuleNameRelative(moduleName: string): boolean;
function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[];
}
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;
+3 -1
View File
@@ -2266,6 +2266,7 @@ declare namespace ts {
charset?: string;
checkJs?: boolean;
declaration?: boolean;
emitDeclarationsOnly?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
downlevelIteration?: boolean;
@@ -2808,12 +2809,13 @@ declare namespace ts {
}
}
declare namespace ts {
const versionMajorMinor = "2.7";
const versionMajorMinor = "2.8";
/** The version of the TypeScript compiler release */
const version: string;
}
declare namespace ts {
function isExternalModuleNameRelative(moduleName: string): boolean;
function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[];
}
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;
@@ -1,8 +1,8 @@
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(3,1): error TS2322: Type 'Object' is not assignable to type 'RegExp'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Property 'exec' is missing in type 'Object'.
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(5,17): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(6,17): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(5,31): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(6,31): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Type 'Object' is not assignable to type 'Error'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Property 'name' is missing in type 'Object'.
@@ -18,10 +18,10 @@ tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Ty
!!! error TS2322: Property 'exec' is missing in type 'Object'.
var a: String = Object.create<Object>("");
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var c: String = Object.create<Number>(1);
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var w: Error = new Object();
@@ -1,17 +1,17 @@
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(5,10): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(6,11): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(9,10): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(10,11): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(13,10): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(14,11): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(21,10): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(22,11): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(28,10): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(29,11): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(36,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(37,11): error TS2558: Expected 0 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(43,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(44,11): error TS2558: Expected 0 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(5,12): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(6,13): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(9,13): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(10,14): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(13,13): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(14,14): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(21,22): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(22,23): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(28,14): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(29,15): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(36,23): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(37,24): error TS2558: Expected 0 type arguments, but got 3.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(43,15): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(44,16): error TS2558: Expected 0 type arguments, but got 3.
==== tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts (14 errors) ====
@@ -20,26 +20,26 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFuncti
function f<T, U>(x: T, y: U): T { return null; }
var r1 = f<number>(1, '');
~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
var r1b = f<number, string, number>(1, '');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
var f2 = <T, U>(x: T, y: U): T => { return null; }
var r2 = f2<number>(1, '');
~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
var r2b = f2<number, string, number>(1, '');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
var f3: { <T, U>(x: T, y: U): T; }
var r3 = f3<number>(1, '');
~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
var r3b = f3<number, string, number>(1, '');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
class C {
@@ -48,10 +48,10 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFuncti
}
}
var r4 = (new C()).f<number>(1, '');
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
var r4b = (new C()).f<number, string, number>(1, '');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
interface I {
@@ -59,10 +59,10 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFuncti
}
var i: I;
var r5 = i.f<number>(1, '');
~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
var r5b = i.f<number, string, number>(1, '');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
class C2<T, U> {
@@ -71,10 +71,10 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFuncti
}
}
var r6 = (new C2()).f<number>(1, '');
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var r6b = (new C2()).f<number, string, number>(1, '');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 3.
interface I2<T, U> {
@@ -82,8 +82,8 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFuncti
}
var i2: I2<number, string>;
var r7 = i2.f<number>(1, '');
~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var r7b = i2.f<number, string, number>(1, '');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 3.
@@ -1,10 +1,10 @@
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(5,9): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(8,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(11,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(18,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(24,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(31,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(37,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(5,11): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(8,13): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(11,13): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(18,22): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(24,14): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(31,23): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(37,15): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(40,10): error TS2347: Untyped function calls may not accept type arguments.
tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(43,10): error TS2347: Untyped function calls may not accept type arguments.
@@ -15,17 +15,17 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFun
function f(x: number) { return null; }
var r = f<string>(1);
~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var f2 = (x: number) => { return null; }
var r2 = f2<string>(1);
~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var f3: { (x: number): any; }
var r3 = f3<string>(1);
~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
class C {
@@ -34,7 +34,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFun
}
}
var r4 = (new C()).f<string>(1);
~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
interface I {
@@ -42,7 +42,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFun
}
var i: I;
var r5 = i.f<string>(1);
~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
class C2 {
@@ -51,7 +51,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFun
}
}
var r6 = (new C2()).f<string>(1);
~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
interface I2 {
@@ -59,7 +59,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFun
}
var i2: I2;
var r7 = i2.f<string>(1);
~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var a;
@@ -1,14 +1,14 @@
tests/cases/compiler/callWithWrongNumberOfTypeArguments.ts(3,1): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/compiler/callWithWrongNumberOfTypeArguments.ts(5,1): error TS2558: Expected 2 type arguments, but got 3.
tests/cases/compiler/callWithWrongNumberOfTypeArguments.ts(3,3): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/compiler/callWithWrongNumberOfTypeArguments.ts(5,3): error TS2558: Expected 2 type arguments, but got 3.
==== tests/cases/compiler/callWithWrongNumberOfTypeArguments.ts (2 errors) ====
function f<T, U>() { }
f<number>();
~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
f<number, string>();
f<number, string, number>();
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
@@ -1,4 +1,4 @@
tests/cases/compiler/constructorInvocationWithTooFewTypeArgs.ts(9,9): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/compiler/constructorInvocationWithTooFewTypeArgs.ts(9,15): error TS2558: Expected 2 type arguments, but got 1.
==== tests/cases/compiler/constructorInvocationWithTooFewTypeArgs.ts (1 errors) ====
@@ -11,6 +11,6 @@ tests/cases/compiler/constructorInvocationWithTooFewTypeArgs.ts(9,9): error TS25
}
var d = new D<number>();
~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
@@ -0,0 +1,26 @@
//// [helloworld.ts]
const Log = {
info(msg: string) {}
}
class HelloWorld {
constructor(private name: string) {
}
public hello() {
Log.info(`Hello ${this.name}`);
}
}
//// [helloworld.d.ts]
declare const Log: {
info(msg: string): void;
};
declare class HelloWorld {
private name;
constructor(name: string);
hello(): void;
}
@@ -0,0 +1,29 @@
=== tests/cases/compiler/helloworld.ts ===
const Log = {
>Log : Symbol(Log, Decl(helloworld.ts, 0, 5))
info(msg: string) {}
>info : Symbol(info, Decl(helloworld.ts, 0, 13))
>msg : Symbol(msg, Decl(helloworld.ts, 1, 7))
}
class HelloWorld {
>HelloWorld : Symbol(HelloWorld, Decl(helloworld.ts, 2, 1))
constructor(private name: string) {
>name : Symbol(HelloWorld.name, Decl(helloworld.ts, 5, 14))
}
public hello() {
>hello : Symbol(HelloWorld.hello, Decl(helloworld.ts, 6, 3))
Log.info(`Hello ${this.name}`);
>Log.info : Symbol(info, Decl(helloworld.ts, 0, 13))
>Log : Symbol(Log, Decl(helloworld.ts, 0, 5))
>info : Symbol(info, Decl(helloworld.ts, 0, 13))
>this.name : Symbol(HelloWorld.name, Decl(helloworld.ts, 5, 14))
>this : Symbol(HelloWorld, Decl(helloworld.ts, 2, 1))
>name : Symbol(HelloWorld.name, Decl(helloworld.ts, 5, 14))
}
}
@@ -0,0 +1,32 @@
=== tests/cases/compiler/helloworld.ts ===
const Log = {
>Log : { info(msg: string): void; }
>{ info(msg: string) {}} : { info(msg: string): void; }
info(msg: string) {}
>info : (msg: string) => void
>msg : string
}
class HelloWorld {
>HelloWorld : HelloWorld
constructor(private name: string) {
>name : string
}
public hello() {
>hello : () => void
Log.info(`Hello ${this.name}`);
>Log.info(`Hello ${this.name}`) : void
>Log.info : (msg: string) => void
>Log : { info(msg: string): void; }
>info : (msg: string) => void
>`Hello ${this.name}` : string
>this.name : string
>this : this
>name : string
}
}
@@ -0,0 +1,7 @@
error TS5052: Option 'emitDeclarationsOnly' cannot be specified without specifying option 'declarations'.
!!! error TS5052: Option 'emitDeclarationsOnly' cannot be specified without specifying option 'declarations'.
==== tests/cases/compiler/hello.ts (0 errors) ====
var hello = "yo!";
@@ -0,0 +1,4 @@
=== tests/cases/compiler/hello.ts ===
var hello = "yo!";
>hello : Symbol(hello, Decl(hello.ts, 0, 3))
@@ -0,0 +1,5 @@
=== tests/cases/compiler/hello.ts ===
var hello = "yo!";
>hello : string
>"yo!" : "yo!"
@@ -0,0 +1,9 @@
error TS5052: Option 'emitDeclarationsOnly' cannot be specified without specifying option 'declarations'.
error TS5053: Option 'emitDeclarationsOnly' cannot be specified with option 'noEmit'.
!!! error TS5052: Option 'emitDeclarationsOnly' cannot be specified without specifying option 'declarations'.
!!! error TS5053: Option 'emitDeclarationsOnly' cannot be specified with option 'noEmit'.
==== tests/cases/compiler/hello.ts (0 errors) ====
var hello = "yo!";
@@ -0,0 +1,4 @@
=== tests/cases/compiler/hello.ts ===
var hello = "yo!";
>hello : Symbol(hello, Decl(hello.ts, 0, 3))
@@ -0,0 +1,5 @@
=== tests/cases/compiler/hello.ts ===
var hello = "yo!";
>hello : string
>"yo!" : "yo!"
@@ -24,6 +24,22 @@ async function* f4() {
for await (x of y) {
}
}
//// [file5.ts]
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
let y: any;
outer: for await (const x of y) {
continue outer;
}
}
//// [file6.ts]
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
let y: any;
outer: for await (const x of y) {
continue outer;
}
}
//// [file1.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -161,3 +177,75 @@ function f4() {
var e_1, _a;
});
}
//// [file5.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator];
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
};
// https://github.com/Microsoft/TypeScript/issues/21363
function f5() {
return __awaiter(this, void 0, void 0, function* () {
let y;
try {
outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) {
const x = yield y_1_1.value;
continue outer;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield _a.call(y_1);
}
finally { if (e_1) throw e_1.error; }
}
var e_1, _a;
});
}
//// [file6.js]
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator];
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
};
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
// https://github.com/Microsoft/TypeScript/issues/21363
function f6() {
return __asyncGenerator(this, arguments, function* f6_1() {
let y;
try {
outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield __await(y_1.next()), !y_1_1.done;) {
const x = yield __await(y_1_1.value);
continue outer;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield __await(_a.call(y_1));
}
finally { if (e_1) throw e_1.error; }
}
var e_1, _a;
});
}
@@ -48,3 +48,33 @@ async function* f4() {
>y : Symbol(y, Decl(file4.ts, 1, 15))
}
}
=== tests/cases/conformance/emitter/es2015/forAwait/file5.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
>f5 : Symbol(f5, Decl(file5.ts, 0, 0))
let y: any;
>y : Symbol(y, Decl(file5.ts, 2, 7))
outer: for await (const x of y) {
>x : Symbol(x, Decl(file5.ts, 3, 27))
>y : Symbol(y, Decl(file5.ts, 2, 7))
continue outer;
}
}
=== tests/cases/conformance/emitter/es2015/forAwait/file6.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
>f6 : Symbol(f6, Decl(file6.ts, 0, 0))
let y: any;
>y : Symbol(y, Decl(file6.ts, 2, 7))
outer: for await (const x of y) {
>x : Symbol(x, Decl(file6.ts, 3, 27))
>y : Symbol(y, Decl(file6.ts, 2, 7))
continue outer;
}
}
@@ -48,3 +48,37 @@ async function* f4() {
>y : any
}
}
=== tests/cases/conformance/emitter/es2015/forAwait/file5.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
>f5 : () => Promise<void>
let y: any;
>y : any
outer: for await (const x of y) {
>outer : any
>x : any
>y : any
continue outer;
>outer : any
}
}
=== tests/cases/conformance/emitter/es2015/forAwait/file6.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
>f6 : () => AsyncIterableIterator<any>
let y: any;
>y : any
outer: for await (const x of y) {
>outer : any
>x : any
>y : any
continue outer;
>outer : any
}
}
@@ -24,6 +24,22 @@ async function* f4() {
for await (x of y) {
}
}
//// [file5.ts]
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
let y: any;
outer: for await (const x of y) {
continue outer;
}
}
//// [file6.ts]
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
let y: any;
outer: for await (const x of y) {
continue outer;
}
}
//// [file1.js]
var __asyncValues = (this && this.__asyncValues) || function (o) {
@@ -141,3 +157,65 @@ function f4() {
var e_1, _a;
});
}
//// [file5.js]
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator];
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
};
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
let y;
try {
outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = await y_1.next(), !y_1_1.done;) {
const x = await y_1_1.value;
continue outer;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (y_1_1 && !y_1_1.done && (_a = y_1.return)) await _a.call(y_1);
}
finally { if (e_1) throw e_1.error; }
}
var e_1, _a;
}
//// [file6.js]
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator];
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
};
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
// https://github.com/Microsoft/TypeScript/issues/21363
function f6() {
return __asyncGenerator(this, arguments, function* f6_1() {
let y;
try {
outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield __await(y_1.next()), !y_1_1.done;) {
const x = yield __await(y_1_1.value);
continue outer;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield __await(_a.call(y_1));
}
finally { if (e_1) throw e_1.error; }
}
var e_1, _a;
});
}
@@ -48,3 +48,33 @@ async function* f4() {
>y : Symbol(y, Decl(file4.ts, 1, 15))
}
}
=== tests/cases/conformance/emitter/es2017/forAwait/file5.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
>f5 : Symbol(f5, Decl(file5.ts, 0, 0))
let y: any;
>y : Symbol(y, Decl(file5.ts, 2, 7))
outer: for await (const x of y) {
>x : Symbol(x, Decl(file5.ts, 3, 27))
>y : Symbol(y, Decl(file5.ts, 2, 7))
continue outer;
}
}
=== tests/cases/conformance/emitter/es2017/forAwait/file6.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
>f6 : Symbol(f6, Decl(file6.ts, 0, 0))
let y: any;
>y : Symbol(y, Decl(file6.ts, 2, 7))
outer: for await (const x of y) {
>x : Symbol(x, Decl(file6.ts, 3, 27))
>y : Symbol(y, Decl(file6.ts, 2, 7))
continue outer;
}
}
@@ -48,3 +48,37 @@ async function* f4() {
>y : any
}
}
=== tests/cases/conformance/emitter/es2017/forAwait/file5.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
>f5 : () => Promise<void>
let y: any;
>y : any
outer: for await (const x of y) {
>outer : any
>x : any
>y : any
continue outer;
>outer : any
}
}
=== tests/cases/conformance/emitter/es2017/forAwait/file6.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
>f6 : () => AsyncIterableIterator<any>
let y: any;
>y : any
outer: for await (const x of y) {
>outer : any
>x : any
>y : any
continue outer;
>outer : any
}
}
@@ -24,6 +24,22 @@ async function* f4() {
for await (x of y) {
}
}
//// [file5.ts]
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
let y: any;
outer: for await (const x of y) {
continue outer;
}
}
//// [file6.ts]
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
let y: any;
outer: for await (const x of y) {
continue outer;
}
}
//// [file1.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -353,3 +369,169 @@ function f4() {
});
});
}
//// [file5.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator];
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
};
// https://github.com/Microsoft/TypeScript/issues/21363
function f5() {
return __awaiter(this, void 0, void 0, function () {
var y, y_1, y_1_1, x, e_1_1, e_1, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 6, 7, 12]);
y_1 = __asyncValues(y);
_b.label = 1;
case 1: return [4 /*yield*/, y_1.next()];
case 2:
if (!(y_1_1 = _b.sent(), !y_1_1.done)) return [3 /*break*/, 5];
return [4 /*yield*/, y_1_1.value];
case 3:
x = _b.sent();
return [3 /*break*/, 4];
case 4: return [3 /*break*/, 1];
case 5: return [3 /*break*/, 12];
case 6:
e_1_1 = _b.sent();
e_1 = { error: e_1_1 };
return [3 /*break*/, 12];
case 7:
_b.trys.push([7, , 10, 11]);
if (!(y_1_1 && !y_1_1.done && (_a = y_1.return))) return [3 /*break*/, 9];
return [4 /*yield*/, _a.call(y_1)];
case 8:
_b.sent();
_b.label = 9;
case 9: return [3 /*break*/, 11];
case 10:
if (e_1) throw e_1.error;
return [7 /*endfinally*/];
case 11: return [7 /*endfinally*/];
case 12: return [2 /*return*/];
}
});
});
}
//// [file6.js]
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator];
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
};
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
// https://github.com/Microsoft/TypeScript/issues/21363
function f6() {
return __asyncGenerator(this, arguments, function f6_1() {
var y, y_1, y_1_1, x, e_1_1, e_1, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 6, 7, 12]);
y_1 = __asyncValues(y);
_b.label = 1;
case 1: return [4 /*yield*/, __await(y_1.next())];
case 2:
if (!(y_1_1 = _b.sent(), !y_1_1.done)) return [3 /*break*/, 5];
return [4 /*yield*/, __await(y_1_1.value)];
case 3:
x = _b.sent();
return [3 /*break*/, 4];
case 4: return [3 /*break*/, 1];
case 5: return [3 /*break*/, 12];
case 6:
e_1_1 = _b.sent();
e_1 = { error: e_1_1 };
return [3 /*break*/, 12];
case 7:
_b.trys.push([7, , 10, 11]);
if (!(y_1_1 && !y_1_1.done && (_a = y_1.return))) return [3 /*break*/, 9];
return [4 /*yield*/, __await(_a.call(y_1))];
case 8:
_b.sent();
_b.label = 9;
case 9: return [3 /*break*/, 11];
case 10:
if (e_1) throw e_1.error;
return [7 /*endfinally*/];
case 11: return [7 /*endfinally*/];
case 12: return [2 /*return*/];
}
});
});
}
@@ -48,3 +48,33 @@ async function* f4() {
>y : Symbol(y, Decl(file4.ts, 1, 15))
}
}
=== tests/cases/conformance/emitter/es5/forAwait/file5.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
>f5 : Symbol(f5, Decl(file5.ts, 0, 0))
let y: any;
>y : Symbol(y, Decl(file5.ts, 2, 7))
outer: for await (const x of y) {
>x : Symbol(x, Decl(file5.ts, 3, 27))
>y : Symbol(y, Decl(file5.ts, 2, 7))
continue outer;
}
}
=== tests/cases/conformance/emitter/es5/forAwait/file6.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
>f6 : Symbol(f6, Decl(file6.ts, 0, 0))
let y: any;
>y : Symbol(y, Decl(file6.ts, 2, 7))
outer: for await (const x of y) {
>x : Symbol(x, Decl(file6.ts, 3, 27))
>y : Symbol(y, Decl(file6.ts, 2, 7))
continue outer;
}
}
@@ -48,3 +48,37 @@ async function* f4() {
>y : any
}
}
=== tests/cases/conformance/emitter/es5/forAwait/file5.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
>f5 : () => Promise<void>
let y: any;
>y : any
outer: for await (const x of y) {
>outer : any
>x : any
>y : any
continue outer;
>outer : any
}
}
=== tests/cases/conformance/emitter/es5/forAwait/file6.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
>f6 : () => AsyncIterableIterator<any>
let y: any;
>y : any
outer: for await (const x of y) {
>outer : any
>x : any
>y : any
continue outer;
>outer : any
}
}
@@ -24,6 +24,22 @@ async function* f4() {
for await (x of y) {
}
}
//// [file5.ts]
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
let y: any;
outer: for await (const x of y) {
continue outer;
}
}
//// [file6.ts]
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
let y: any;
outer: for await (const x of y) {
continue outer;
}
}
//// [file1.js]
async function f1() {
@@ -49,3 +65,19 @@ async function* f4() {
for await (x of y) {
}
}
//// [file5.js]
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
let y;
outer: for await (const x of y) {
continue outer;
}
}
//// [file6.js]
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
let y;
outer: for await (const x of y) {
continue outer;
}
}
@@ -48,3 +48,33 @@ async function* f4() {
>y : Symbol(y, Decl(file4.ts, 1, 15))
}
}
=== tests/cases/conformance/emitter/esnext/forAwait/file5.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
>f5 : Symbol(f5, Decl(file5.ts, 0, 0))
let y: any;
>y : Symbol(y, Decl(file5.ts, 2, 7))
outer: for await (const x of y) {
>x : Symbol(x, Decl(file5.ts, 3, 27))
>y : Symbol(y, Decl(file5.ts, 2, 7))
continue outer;
}
}
=== tests/cases/conformance/emitter/esnext/forAwait/file6.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
>f6 : Symbol(f6, Decl(file6.ts, 0, 0))
let y: any;
>y : Symbol(y, Decl(file6.ts, 2, 7))
outer: for await (const x of y) {
>x : Symbol(x, Decl(file6.ts, 3, 27))
>y : Symbol(y, Decl(file6.ts, 2, 7))
continue outer;
}
}
@@ -48,3 +48,37 @@ async function* f4() {
>y : any
}
}
=== tests/cases/conformance/emitter/esnext/forAwait/file5.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function f5() {
>f5 : () => Promise<void>
let y: any;
>y : any
outer: for await (const x of y) {
>outer : any
>x : any
>y : any
continue outer;
>outer : any
}
}
=== tests/cases/conformance/emitter/esnext/forAwait/file6.ts ===
// https://github.com/Microsoft/TypeScript/issues/21363
async function* f6() {
>f6 : () => AsyncIterableIterator<any>
let y: any;
>y : any
outer: for await (const x of y) {
>outer : any
>x : any
>y : any
continue outer;
>outer : any
}
}
@@ -1,11 +1,11 @@
tests/cases/compiler/emptyTypeArgumentList.ts(2,1): error TS2558: Expected 1 type arguments, but got 0.
tests/cases/compiler/emptyTypeArgumentList.ts(2,4): error TS1099: Type argument list cannot be empty.
tests/cases/compiler/emptyTypeArgumentList.ts(2,5): error TS2558: Expected 1 type arguments, but got 0.
==== tests/cases/compiler/emptyTypeArgumentList.ts (2 errors) ====
function foo<T>() { }
foo<>();
~~~~~~~
!!! error TS2558: Expected 1 type arguments, but got 0.
~~
!!! error TS1099: Type argument list cannot be empty.
!!! error TS1099: Type argument list cannot be empty.
!!! error TS2558: Expected 1 type arguments, but got 0.
@@ -1,11 +1,11 @@
tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,1): error TS2558: Expected 1 type arguments, but got 0.
tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,8): error TS1099: Type argument list cannot be empty.
tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,9): error TS2558: Expected 1 type arguments, but got 0.
==== tests/cases/compiler/emptyTypeArgumentListWithNew.ts (2 errors) ====
class foo<T> { }
new foo<>();
~~~~~~~~~~~
!!! error TS2558: Expected 1 type arguments, but got 0.
~~
!!! error TS1099: Type argument list cannot be empty.
!!! error TS1099: Type argument list cannot be empty.
!!! error TS2558: Expected 1 type arguments, but got 0.
@@ -21,9 +21,14 @@ tests/cases/compiler/excessPropertyCheckWithUnions.ts(49,35): error TS2322: Type
Object literal may only specify known properties, and 'second' does not exist in type '{ a: 1; b: 1; first: string; }'.
tests/cases/compiler/excessPropertyCheckWithUnions.ts(50,35): error TS2322: Type '{ a: 1; b: 1; first: string; third: string; }' is not assignable to type 'Overlapping'.
Object literal may only specify known properties, and 'third' does not exist in type '{ a: 1; b: 1; first: string; }'.
tests/cases/compiler/excessPropertyCheckWithUnions.ts(66,9): error TS2322: Type '{ kind: "A"; n: { a: string; b: string; }; }' is not assignable to type 'AB'.
Type '{ kind: "A"; n: { a: string; b: string; }; }' is not assignable to type '{ kind: "A"; n: AN; }'.
Types of property 'n' are incompatible.
Type '{ a: string; b: string; }' is not assignable to type 'AN'.
Object literal may only specify known properties, and 'b' does not exist in type 'AN'.
==== tests/cases/compiler/excessPropertyCheckWithUnions.ts (9 errors) ====
==== tests/cases/compiler/excessPropertyCheckWithUnions.ts (10 errors) ====
type ADT = {
tag: "A",
a1: string
@@ -112,4 +117,29 @@ tests/cases/compiler/excessPropertyCheckWithUnions.ts(50,35): error TS2322: Type
declare let t1: { a: any, b: any, c: any } | { c: any, d: any, e: any }
let t2 = { ...t1 }
t0 = t2
// Nested excess property checks work with discriminated unions
type AN = { a: string } | { c: string }
type BN = { b: string }
type AB = { kind: "A", n: AN } | { kind: "B", n: BN }
const abab: AB = {
kind: "A",
n: {
a: "a",
b: "b", // excess -- kind: "A"
~~~~~~
!!! error TS2322: Type '{ kind: "A"; n: { a: string; b: string; }; }' is not assignable to type 'AB'.
!!! error TS2322: Type '{ kind: "A"; n: { a: string; b: string; }; }' is not assignable to type '{ kind: "A"; n: AN; }'.
!!! error TS2322: Types of property 'n' are incompatible.
!!! error TS2322: Type '{ a: string; b: string; }' is not assignable to type 'AN'.
!!! error TS2322: Object literal may only specify known properties, and 'b' does not exist in type 'AN'.
}
}
const abac: AB = {
kind: "A",
n: {
a: "a",
c: "c", // ok -- kind: "A", an: { a: string } | { c: string }
}
}
@@ -55,6 +55,25 @@ declare let t0: { a: any, b: any } | { d: any, e: any }
declare let t1: { a: any, b: any, c: any } | { c: any, d: any, e: any }
let t2 = { ...t1 }
t0 = t2
// Nested excess property checks work with discriminated unions
type AN = { a: string } | { c: string }
type BN = { b: string }
type AB = { kind: "A", n: AN } | { kind: "B", n: BN }
const abab: AB = {
kind: "A",
n: {
a: "a",
b: "b", // excess -- kind: "A"
}
}
const abac: AB = {
kind: "A",
n: {
a: "a",
c: "c", // ok -- kind: "A", an: { a: string } | { c: string }
}
}
//// [excessPropertyCheckWithUnions.js]
@@ -89,3 +108,17 @@ over = { a: 1, b: 1, first: "ok", second: "error" };
over = { a: 1, b: 1, first: "ok", third: "error" };
var t2 = __assign({}, t1);
t0 = t2;
var abab = {
kind: "A",
n: {
a: "a",
b: "b"
}
};
var abac = {
kind: "A",
n: {
a: "a",
c: "c"
}
};
@@ -167,3 +167,57 @@ t0 = t2
>t0 : Symbol(t0, Decl(excessPropertyCheckWithUnions.ts, 52, 11))
>t2 : Symbol(t2, Decl(excessPropertyCheckWithUnions.ts, 54, 3))
// Nested excess property checks work with discriminated unions
type AN = { a: string } | { c: string }
>AN : Symbol(AN, Decl(excessPropertyCheckWithUnions.ts, 55, 7))
>a : Symbol(a, Decl(excessPropertyCheckWithUnions.ts, 58, 11))
>c : Symbol(c, Decl(excessPropertyCheckWithUnions.ts, 58, 27))
type BN = { b: string }
>BN : Symbol(BN, Decl(excessPropertyCheckWithUnions.ts, 58, 39))
>b : Symbol(b, Decl(excessPropertyCheckWithUnions.ts, 59, 11))
type AB = { kind: "A", n: AN } | { kind: "B", n: BN }
>AB : Symbol(AB, Decl(excessPropertyCheckWithUnions.ts, 59, 23))
>kind : Symbol(kind, Decl(excessPropertyCheckWithUnions.ts, 60, 11))
>n : Symbol(n, Decl(excessPropertyCheckWithUnions.ts, 60, 22))
>AN : Symbol(AN, Decl(excessPropertyCheckWithUnions.ts, 55, 7))
>kind : Symbol(kind, Decl(excessPropertyCheckWithUnions.ts, 60, 34))
>n : Symbol(n, Decl(excessPropertyCheckWithUnions.ts, 60, 45))
>BN : Symbol(BN, Decl(excessPropertyCheckWithUnions.ts, 58, 39))
const abab: AB = {
>abab : Symbol(abab, Decl(excessPropertyCheckWithUnions.ts, 61, 5))
>AB : Symbol(AB, Decl(excessPropertyCheckWithUnions.ts, 59, 23))
kind: "A",
>kind : Symbol(kind, Decl(excessPropertyCheckWithUnions.ts, 61, 18))
n: {
>n : Symbol(n, Decl(excessPropertyCheckWithUnions.ts, 62, 14))
a: "a",
>a : Symbol(a, Decl(excessPropertyCheckWithUnions.ts, 63, 8))
b: "b", // excess -- kind: "A"
>b : Symbol(b, Decl(excessPropertyCheckWithUnions.ts, 64, 15))
}
}
const abac: AB = {
>abac : Symbol(abac, Decl(excessPropertyCheckWithUnions.ts, 68, 5))
>AB : Symbol(AB, Decl(excessPropertyCheckWithUnions.ts, 59, 23))
kind: "A",
>kind : Symbol(kind, Decl(excessPropertyCheckWithUnions.ts, 68, 18))
n: {
>n : Symbol(n, Decl(excessPropertyCheckWithUnions.ts, 69, 14))
a: "a",
>a : Symbol(a, Decl(excessPropertyCheckWithUnions.ts, 70, 8))
c: "c", // ok -- kind: "A", an: { a: string } | { c: string }
>c : Symbol(c, Decl(excessPropertyCheckWithUnions.ts, 71, 15))
}
}
@@ -221,3 +221,67 @@ t0 = t2
>t0 : { a: any; b: any; } | { d: any; e: any; }
>t2 : { a: any; b: any; c: any; } | { c: any; d: any; e: any; }
// Nested excess property checks work with discriminated unions
type AN = { a: string } | { c: string }
>AN : AN
>a : string
>c : string
type BN = { b: string }
>BN : BN
>b : string
type AB = { kind: "A", n: AN } | { kind: "B", n: BN }
>AB : AB
>kind : "A"
>n : AN
>AN : AN
>kind : "B"
>n : BN
>BN : BN
const abab: AB = {
>abab : AB
>AB : AB
>{ kind: "A", n: { a: "a", b: "b", // excess -- kind: "A" }} : { kind: "A"; n: { a: string; b: string; }; }
kind: "A",
>kind : "A"
>"A" : "A"
n: {
>n : { a: string; b: string; }
>{ a: "a", b: "b", // excess -- kind: "A" } : { a: string; b: string; }
a: "a",
>a : string
>"a" : "a"
b: "b", // excess -- kind: "A"
>b : string
>"b" : "b"
}
}
const abac: AB = {
>abac : AB
>AB : AB
>{ kind: "A", n: { a: "a", c: "c", // ok -- kind: "A", an: { a: string } | { c: string } }} : { kind: "A"; n: { a: string; c: string; }; }
kind: "A",
>kind : "A"
>"A" : "A"
n: {
>n : { a: string; c: string; }
>{ a: "a", c: "c", // ok -- kind: "A", an: { a: string } | { c: string } } : { a: string; c: string; }
a: "a",
>a : string
>"a" : "a"
c: "c", // ok -- kind: "A", an: { a: string } | { c: string }
>c : string
>"c" : "c"
}
}
@@ -0,0 +1,13 @@
// ==ORIGINAL==
switch (1) {
case /*[#|*/1/*|]*/:
break;
}
// ==SCOPE::Extract to constant in enclosing scope==
const newLocal = 1;
switch (1) {
case /*RENAME*/newLocal:
break;
}
@@ -0,0 +1,13 @@
// ==ORIGINAL==
switch (1) {
case /*[#|*/1/*|]*/:
break;
}
// ==SCOPE::Extract to constant in enclosing scope==
const newLocal = 1;
switch (1) {
case /*RENAME*/newLocal:
break;
}
@@ -1,32 +1,32 @@
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,14): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,14): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,15): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,15): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,17): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(12,17): error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(13,15): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,15): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(13,17): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17): error TS2558: Expected 0 type arguments, but got 1.
==== tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts (8 errors) ====
function foo<T, U>(x:T, y:U, f: (v: T) => U) {
var r1 = f<number>(1);
~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var r2 = f(1);
~
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'.
var r3 = f<any>(null);
~~~~~~~~~~~~
~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var r4 = f(null);
var r11 = f(x);
var r21 = f<number>(x);
~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var r31 = f<any>(null);
~~~~~~~~~~~~
~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var r41 = f(null);
@@ -34,10 +34,10 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,15
~
!!! error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'.
var r22 = f<number>(y);
~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var r32 = f<any>(null);
~~~~~~~~~~~~
~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var r42 = f(null);
}
@@ -3,8 +3,8 @@ tests/cases/compiler/genericDefaultsErrors.ts(4,59): error TS2344: Type 'T' does
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/genericDefaultsErrors.ts(5,44): error TS2344: Type 'T' does not satisfy the constraint 'number'.
tests/cases/compiler/genericDefaultsErrors.ts(6,39): error TS2344: Type 'number' does not satisfy the constraint 'T'.
tests/cases/compiler/genericDefaultsErrors.ts(10,1): error TS2558: Expected 2-3 type arguments, but got 1.
tests/cases/compiler/genericDefaultsErrors.ts(13,1): error TS2558: Expected 2-3 type arguments, but got 4.
tests/cases/compiler/genericDefaultsErrors.ts(10,5): error TS2558: Expected 2-3 type arguments, but got 1.
tests/cases/compiler/genericDefaultsErrors.ts(13,5): error TS2558: Expected 2-3 type arguments, but got 4.
tests/cases/compiler/genericDefaultsErrors.ts(17,13): error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'.
tests/cases/compiler/genericDefaultsErrors.ts(19,11): error TS2428: All declarations of 'i00' must have identical type parameters.
tests/cases/compiler/genericDefaultsErrors.ts(20,11): error TS2428: All declarations of 'i00' must have identical type parameters.
@@ -44,12 +44,12 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,29): error TS2716: Type paramet
declare function f11<T, U, V = number>(): void;
f11(); // ok
f11<1>(); // error
~~~~~~~~
~
!!! error TS2558: Expected 2-3 type arguments, but got 1.
f11<1, 2>(); // ok
f11<1, 2, 3>(); // ok
f11<1, 2, 3, 4>(); // error
~~~~~~~~~~~~~~~~~
~~~~~~~~~~
!!! error TS2558: Expected 2-3 type arguments, but got 4.
declare function f12<T, U = T>(a?: U): void;
@@ -1,6 +1,6 @@
tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'.
tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,35): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,35): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,41): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expected 0 type arguments, but got 1.
==== tests/cases/compiler/genericWithOpenTypeParameters1.ts (3 errors) ====
@@ -14,10 +14,10 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,35): error TS2558: Expe
~
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'.
var f2 = <T>(x: B<T>) => { return x.foo<T>(1); } // error
~~~~~~~~~~~
~
!!! error TS2558: Expected 0 type arguments, but got 1.
var f3 = <T>(x: B<T>) => { return x.foo<number>(1); } // error
~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var f4 = (x: B<number>) => { return x.foo(1); } // no error
@@ -1,5 +1,5 @@
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGenericClassWithWrongNumberOfTypeArguments.ts(8,9): error TS2558: Expected 1 type arguments, but got 2.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGenericClassWithWrongNumberOfTypeArguments.ts(16,9): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGenericClassWithWrongNumberOfTypeArguments.ts(8,15): error TS2558: Expected 1 type arguments, but got 2.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGenericClassWithWrongNumberOfTypeArguments.ts(16,15): error TS2558: Expected 2 type arguments, but got 1.
==== tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGenericClassWithWrongNumberOfTypeArguments.ts (2 errors) ====
@@ -11,7 +11,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGeneri
}
var c = new C<number, number>();
~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
!!! error TS2558: Expected 1 type arguments, but got 2.
class D<T, U> {
@@ -21,5 +21,5 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGeneri
// BUG 794238
var d = new D<number>();
~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
@@ -1,8 +1,8 @@
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(8,9): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(8,15): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(11,9): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(11,9): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(11,17): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(14,10): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(14,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(14,16): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(18,10): error TS2347: Untyped function calls may not accept type arguments.
@@ -15,21 +15,21 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGen
}
var c = new C<number>();
~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
function Foo(): void { }
var r = new Foo<number>();
~~~~~~~~~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var f: { (): void };
var r2 = new f<number>();
~~~~~~~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
var a: any;
@@ -1,7 +1,7 @@
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): error TS2558: Expected 2 type arguments, but got 1.
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,15): error TS2558: Expected 2 type arguments, but got 1.
==== tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts (2 errors) ====
@@ -20,6 +20,6 @@ tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): e
!!! error TS2345: Type 'string | number' is not assignable to type 'number'.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
var r7b = map<number>([1, ""], (x) => x.toString()); // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
var r8 = map<any, string>([1, ""], (x) => x.toString());
@@ -0,0 +1,60 @@
//// [tests/cases/compiler/moduleDeclarationExportStarShadowingGlobalIsNameable.ts] ////
//// [index.ts]
export * from "./account";
//// [account.ts]
export interface Account {
myAccNum: number;
}
interface Account2 {
myAccNum: number;
}
export { Account2 as Acc };
//// [index.ts]
declare global {
interface Account {
someProp: number;
}
interface Acc {
someProp: number;
}
}
import * as model from "./model";
export const func = (account: model.Account, acc2: model.Acc) => {};
//// [account.js]
"use strict";
exports.__esModule = true;
//// [index.js]
"use strict";
exports.__esModule = true;
//// [index.js]
"use strict";
exports.__esModule = true;
exports.func = function (account, acc2) { };
//// [account.d.ts]
export interface Account {
myAccNum: number;
}
interface Account2 {
myAccNum: number;
}
export { Account2 as Acc };
//// [index.d.ts]
export * from "./account";
//// [index.d.ts]
declare global {
interface Account {
someProp: number;
}
interface Acc {
someProp: number;
}
}
import * as model from "./model";
export declare const func: (account: model.Account, acc2: model.Acc) => void;
@@ -0,0 +1,49 @@
=== tests/cases/compiler/model/index.ts ===
export * from "./account";
No type information for this code.
No type information for this code.=== tests/cases/compiler/model/account.ts ===
export interface Account {
>Account : Symbol(Account, Decl(account.ts, 0, 0))
myAccNum: number;
>myAccNum : Symbol(Account.myAccNum, Decl(account.ts, 0, 26))
}
interface Account2 {
>Account2 : Symbol(Account2, Decl(account.ts, 2, 1))
myAccNum: number;
>myAccNum : Symbol(Account2.myAccNum, Decl(account.ts, 3, 20))
}
export { Account2 as Acc };
>Account2 : Symbol(Acc, Decl(account.ts, 6, 8))
>Acc : Symbol(Acc, Decl(account.ts, 6, 8))
=== tests/cases/compiler/index.ts ===
declare global {
>global : Symbol(global, Decl(index.ts, 0, 0))
interface Account {
>Account : Symbol(Account, Decl(index.ts, 0, 16))
someProp: number;
>someProp : Symbol(Account.someProp, Decl(index.ts, 1, 23))
}
interface Acc {
>Acc : Symbol(Acc, Decl(index.ts, 3, 5))
someProp: number;
>someProp : Symbol(Acc.someProp, Decl(index.ts, 4, 19))
}
}
import * as model from "./model";
>model : Symbol(model, Decl(index.ts, 8, 6))
export const func = (account: model.Account, acc2: model.Acc) => {};
>func : Symbol(func, Decl(index.ts, 9, 12))
>account : Symbol(account, Decl(index.ts, 9, 21))
>model : Symbol(model, Decl(index.ts, 8, 6))
>Account : Symbol(model.Account, Decl(account.ts, 0, 0))
>acc2 : Symbol(acc2, Decl(index.ts, 9, 44))
>model : Symbol(model, Decl(index.ts, 8, 6))
>Acc : Symbol(model.Acc, Decl(account.ts, 6, 8))
@@ -0,0 +1,50 @@
=== tests/cases/compiler/model/index.ts ===
export * from "./account";
No type information for this code.
No type information for this code.=== tests/cases/compiler/model/account.ts ===
export interface Account {
>Account : Account
myAccNum: number;
>myAccNum : number
}
interface Account2 {
>Account2 : Account2
myAccNum: number;
>myAccNum : number
}
export { Account2 as Acc };
>Account2 : any
>Acc : any
=== tests/cases/compiler/index.ts ===
declare global {
>global : any
interface Account {
>Account : Account
someProp: number;
>someProp : number
}
interface Acc {
>Acc : Acc
someProp: number;
>someProp : number
}
}
import * as model from "./model";
>model : typeof model
export const func = (account: model.Account, acc2: model.Acc) => {};
>func : (account: model.Account, acc2: model.Acc) => void
>(account: model.Account, acc2: model.Acc) => {} : (account: model.Account, acc2: model.Acc) => void
>account : model.Account
>model : any
>Account : model.Account
>acc2 : model.Acc
>model : any
>Acc : model.Acc
@@ -0,0 +1,92 @@
tests/cases/compiler/optionalParameterInDestructuringWithInitializer.ts(6,8): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
Type 'undefined' is not assignable to type 'number'.
tests/cases/compiler/optionalParameterInDestructuringWithInitializer.ts(16,7): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
Type 'undefined' is not assignable to type 'number'.
tests/cases/compiler/optionalParameterInDestructuringWithInitializer.ts(21,7): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
Type 'undefined' is not assignable to type 'number'.
tests/cases/compiler/optionalParameterInDestructuringWithInitializer.ts(31,8): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
Type 'undefined' is not assignable to type 'number'.
tests/cases/compiler/optionalParameterInDestructuringWithInitializer.ts(45,10): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
Type 'undefined' is not assignable to type 'number'.
tests/cases/compiler/optionalParameterInDestructuringWithInitializer.ts(53,11): error TS2345: Argument of type 'number | null' is not assignable to parameter of type 'number | undefined'.
Type 'null' is not assignable to type 'number | undefined'.
==== tests/cases/compiler/optionalParameterInDestructuringWithInitializer.ts (6 errors) ====
// https://github.com/Microsoft/TypeScript/issues/17080
declare function f(a:number,b:number): void;
function func1( {a, b}: {a: number, b?: number} = {a: 1, b: 2} ) {
f(a, b)
~
!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
!!! error TS2345: Type 'undefined' is not assignable to type 'number'.
// error
}
function func2( {a, b = 3}: {a: number, b?:number} = {a: 1,b: 2} ) {
f(a, b)
// no error
}
function func3( {a, b}: {a: number, b?: number} = {a: 1} ) {
f(a,b)
~
!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
!!! error TS2345: Type 'undefined' is not assignable to type 'number'.
// error
}
function func4( {a: {b, c}, d}: {a: {b: number,c?: number},d: number} = {a: {b: 1,c: 2},d: 3} ) {
f(b,c)
~
!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
!!! error TS2345: Type 'undefined' is not assignable to type 'number'.
// error
}
function func5({a: {b, c = 4}, d}: {a: {b: number,c?: number},d: number} = {a: {b: 1,c: 2},d: 3} ) {
f(b, c)
// no error
}
function func6( {a: {b, c} = {b: 4, c: 5}, d}: {a: {b: number, c?: number}, d: number} = {a: {b: 1,c: 2}, d: 3} ) {
f(b, c)
~
!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
!!! error TS2345: Type 'undefined' is not assignable to type 'number'.
// error
}
function func7( {a: {b, c = 6} = {b: 4, c: 5}, d}: {a: {b: number, c?: number}, d: number} = {a: {b: 1, c: 2}, d: 3} ) {
f(b, c)
// no error
}
interface Foo {
readonly bar?: number;
}
function performFoo({ bar }: Foo = {}) {
useBar(bar);
~~~
!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
!!! error TS2345: Type 'undefined' is not assignable to type 'number'.
}
declare function useBar(bar: number): void;
performFoo();
function performFoo2({ bar = null }: Foo = {}) {
useBar2(bar);
~~~
!!! error TS2345: Argument of type 'number | null' is not assignable to parameter of type 'number | undefined'.
!!! error TS2345: Type 'null' is not assignable to type 'number | undefined'.
}
declare function useBar2(bar: number | undefined): void;
performFoo2();
@@ -0,0 +1,108 @@
//// [optionalParameterInDestructuringWithInitializer.ts]
// https://github.com/Microsoft/TypeScript/issues/17080
declare function f(a:number,b:number): void;
function func1( {a, b}: {a: number, b?: number} = {a: 1, b: 2} ) {
f(a, b)
// error
}
function func2( {a, b = 3}: {a: number, b?:number} = {a: 1,b: 2} ) {
f(a, b)
// no error
}
function func3( {a, b}: {a: number, b?: number} = {a: 1} ) {
f(a,b)
// error
}
function func4( {a: {b, c}, d}: {a: {b: number,c?: number},d: number} = {a: {b: 1,c: 2},d: 3} ) {
f(b,c)
// error
}
function func5({a: {b, c = 4}, d}: {a: {b: number,c?: number},d: number} = {a: {b: 1,c: 2},d: 3} ) {
f(b, c)
// no error
}
function func6( {a: {b, c} = {b: 4, c: 5}, d}: {a: {b: number, c?: number}, d: number} = {a: {b: 1,c: 2}, d: 3} ) {
f(b, c)
// error
}
function func7( {a: {b, c = 6} = {b: 4, c: 5}, d}: {a: {b: number, c?: number}, d: number} = {a: {b: 1, c: 2}, d: 3} ) {
f(b, c)
// no error
}
interface Foo {
readonly bar?: number;
}
function performFoo({ bar }: Foo = {}) {
useBar(bar);
}
declare function useBar(bar: number): void;
performFoo();
function performFoo2({ bar = null }: Foo = {}) {
useBar2(bar);
}
declare function useBar2(bar: number | undefined): void;
performFoo2();
//// [optionalParameterInDestructuringWithInitializer.js]
// https://github.com/Microsoft/TypeScript/issues/17080
function func1(_a) {
var _b = _a === void 0 ? { a: 1, b: 2 } : _a, a = _b.a, b = _b.b;
f(a, b);
// error
}
function func2(_a) {
var _b = _a === void 0 ? { a: 1, b: 2 } : _a, a = _b.a, _c = _b.b, b = _c === void 0 ? 3 : _c;
f(a, b);
// no error
}
function func3(_a) {
var _b = _a === void 0 ? { a: 1 } : _a, a = _b.a, b = _b.b;
f(a, b);
// error
}
function func4(_a) {
var _b = _a === void 0 ? { a: { b: 1, c: 2 }, d: 3 } : _a, _c = _b.a, b = _c.b, c = _c.c, d = _b.d;
f(b, c);
// error
}
function func5(_a) {
var _b = _a === void 0 ? { a: { b: 1, c: 2 }, d: 3 } : _a, _c = _b.a, b = _c.b, _d = _c.c, c = _d === void 0 ? 4 : _d, d = _b.d;
f(b, c);
// no error
}
function func6(_a) {
var _b = _a === void 0 ? { a: { b: 1, c: 2 }, d: 3 } : _a, _c = _b.a, _d = _c === void 0 ? { b: 4, c: 5 } : _c, b = _d.b, c = _d.c, d = _b.d;
f(b, c);
// error
}
function func7(_a) {
var _b = _a === void 0 ? { a: { b: 1, c: 2 }, d: 3 } : _a, _c = _b.a, _d = _c === void 0 ? { b: 4, c: 5 } : _c, b = _d.b, _e = _d.c, c = _e === void 0 ? 6 : _e, d = _b.d;
f(b, c);
// no error
}
function performFoo(_a) {
var bar = (_a === void 0 ? {} : _a).bar;
useBar(bar);
}
performFoo();
function performFoo2(_a) {
var _b = (_a === void 0 ? {} : _a).bar, bar = _b === void 0 ? null : _b;
useBar2(bar);
}
performFoo2();
@@ -0,0 +1,195 @@
=== tests/cases/compiler/optionalParameterInDestructuringWithInitializer.ts ===
// https://github.com/Microsoft/TypeScript/issues/17080
declare function f(a:number,b:number): void;
>f : Symbol(f, Decl(optionalParameterInDestructuringWithInitializer.ts, 0, 0))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 2, 19))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 2, 28))
function func1( {a, b}: {a: number, b?: number} = {a: 1, b: 2} ) {
>func1 : Symbol(func1, Decl(optionalParameterInDestructuringWithInitializer.ts, 2, 44))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 4, 17))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 4, 19))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 4, 25))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 4, 35))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 4, 51))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 4, 56))
f(a, b)
>f : Symbol(f, Decl(optionalParameterInDestructuringWithInitializer.ts, 0, 0))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 4, 17))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 4, 19))
// error
}
function func2( {a, b = 3}: {a: number, b?:number} = {a: 1,b: 2} ) {
>func2 : Symbol(func2, Decl(optionalParameterInDestructuringWithInitializer.ts, 7, 1))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 9, 17))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 9, 19))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 9, 29))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 9, 39))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 9, 54))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 9, 59))
f(a, b)
>f : Symbol(f, Decl(optionalParameterInDestructuringWithInitializer.ts, 0, 0))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 9, 17))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 9, 19))
// no error
}
function func3( {a, b}: {a: number, b?: number} = {a: 1} ) {
>func3 : Symbol(func3, Decl(optionalParameterInDestructuringWithInitializer.ts, 12, 1))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 14, 17))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 14, 19))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 14, 25))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 14, 35))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 14, 51))
f(a,b)
>f : Symbol(f, Decl(optionalParameterInDestructuringWithInitializer.ts, 0, 0))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 14, 17))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 14, 19))
// error
}
function func4( {a: {b, c}, d}: {a: {b: number,c?: number},d: number} = {a: {b: 1,c: 2},d: 3} ) {
>func4 : Symbol(func4, Decl(optionalParameterInDestructuringWithInitializer.ts, 17, 1))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 33))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 21))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 23))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 27))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 33))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 37))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 47))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 59))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 73))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 77))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 82))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 88))
f(b,c)
>f : Symbol(f, Decl(optionalParameterInDestructuringWithInitializer.ts, 0, 0))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 21))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 19, 23))
// error
}
function func5({a: {b, c = 4}, d}: {a: {b: number,c?: number},d: number} = {a: {b: 1,c: 2},d: 3} ) {
>func5 : Symbol(func5, Decl(optionalParameterInDestructuringWithInitializer.ts, 22, 1))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 36))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 20))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 22))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 30))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 36))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 40))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 50))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 62))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 76))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 80))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 85))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 91))
f(b, c)
>f : Symbol(f, Decl(optionalParameterInDestructuringWithInitializer.ts, 0, 0))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 20))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 24, 22))
// no error
}
function func6( {a: {b, c} = {b: 4, c: 5}, d}: {a: {b: number, c?: number}, d: number} = {a: {b: 1,c: 2}, d: 3} ) {
>func6 : Symbol(func6, Decl(optionalParameterInDestructuringWithInitializer.ts, 27, 1))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 48))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 21))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 23))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 30))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 35))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 42))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 48))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 52))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 62))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 75))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 90))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 94))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 99))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 105))
f(b, c)
>f : Symbol(f, Decl(optionalParameterInDestructuringWithInitializer.ts, 0, 0))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 21))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 29, 23))
// error
}
function func7( {a: {b, c = 6} = {b: 4, c: 5}, d}: {a: {b: number, c?: number}, d: number} = {a: {b: 1, c: 2}, d: 3} ) {
>func7 : Symbol(func7, Decl(optionalParameterInDestructuringWithInitializer.ts, 32, 1))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 52))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 21))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 23))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 34))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 39))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 46))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 52))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 56))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 66))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 79))
>a : Symbol(a, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 94))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 98))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 103))
>d : Symbol(d, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 110))
f(b, c)
>f : Symbol(f, Decl(optionalParameterInDestructuringWithInitializer.ts, 0, 0))
>b : Symbol(b, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 21))
>c : Symbol(c, Decl(optionalParameterInDestructuringWithInitializer.ts, 34, 23))
// no error
}
interface Foo {
>Foo : Symbol(Foo, Decl(optionalParameterInDestructuringWithInitializer.ts, 37, 1))
readonly bar?: number;
>bar : Symbol(Foo.bar, Decl(optionalParameterInDestructuringWithInitializer.ts, 39, 15))
}
function performFoo({ bar }: Foo = {}) {
>performFoo : Symbol(performFoo, Decl(optionalParameterInDestructuringWithInitializer.ts, 41, 1))
>bar : Symbol(bar, Decl(optionalParameterInDestructuringWithInitializer.ts, 43, 21))
>Foo : Symbol(Foo, Decl(optionalParameterInDestructuringWithInitializer.ts, 37, 1))
useBar(bar);
>useBar : Symbol(useBar, Decl(optionalParameterInDestructuringWithInitializer.ts, 45, 1))
>bar : Symbol(bar, Decl(optionalParameterInDestructuringWithInitializer.ts, 43, 21))
}
declare function useBar(bar: number): void;
>useBar : Symbol(useBar, Decl(optionalParameterInDestructuringWithInitializer.ts, 45, 1))
>bar : Symbol(bar, Decl(optionalParameterInDestructuringWithInitializer.ts, 47, 24))
performFoo();
>performFoo : Symbol(performFoo, Decl(optionalParameterInDestructuringWithInitializer.ts, 41, 1))
function performFoo2({ bar = null }: Foo = {}) {
>performFoo2 : Symbol(performFoo2, Decl(optionalParameterInDestructuringWithInitializer.ts, 49, 13))
>bar : Symbol(bar, Decl(optionalParameterInDestructuringWithInitializer.ts, 51, 22))
>Foo : Symbol(Foo, Decl(optionalParameterInDestructuringWithInitializer.ts, 37, 1))
useBar2(bar);
>useBar2 : Symbol(useBar2, Decl(optionalParameterInDestructuringWithInitializer.ts, 53, 1))
>bar : Symbol(bar, Decl(optionalParameterInDestructuringWithInitializer.ts, 51, 22))
}
declare function useBar2(bar: number | undefined): void;
>useBar2 : Symbol(useBar2, Decl(optionalParameterInDestructuringWithInitializer.ts, 53, 1))
>bar : Symbol(bar, Decl(optionalParameterInDestructuringWithInitializer.ts, 55, 25))
performFoo2();
>performFoo2 : Symbol(performFoo2, Decl(optionalParameterInDestructuringWithInitializer.ts, 49, 13))
@@ -0,0 +1,246 @@
=== tests/cases/compiler/optionalParameterInDestructuringWithInitializer.ts ===
// https://github.com/Microsoft/TypeScript/issues/17080
declare function f(a:number,b:number): void;
>f : (a: number, b: number) => void
>a : number
>b : number
function func1( {a, b}: {a: number, b?: number} = {a: 1, b: 2} ) {
>func1 : ({ a, b }?: { a: number; b?: number | undefined; }) => void
>a : number
>b : number | undefined
>a : number
>b : number | undefined
>{a: 1, b: 2} : { a: number; b: number; }
>a : number
>1 : 1
>b : number
>2 : 2
f(a, b)
>f(a, b) : void
>f : (a: number, b: number) => void
>a : number
>b : number | undefined
// error
}
function func2( {a, b = 3}: {a: number, b?:number} = {a: 1,b: 2} ) {
>func2 : ({ a, b }?: { a: number; b?: number | undefined; }) => void
>a : number
>b : number
>3 : 3
>a : number
>b : number | undefined
>{a: 1,b: 2} : { a: number; b: number; }
>a : number
>1 : 1
>b : number
>2 : 2
f(a, b)
>f(a, b) : void
>f : (a: number, b: number) => void
>a : number
>b : number
// no error
}
function func3( {a, b}: {a: number, b?: number} = {a: 1} ) {
>func3 : ({ a, b }?: { a: number; b?: number | undefined; }) => void
>a : number
>b : number | undefined
>a : number
>b : number | undefined
>{a: 1} : { a: number; }
>a : number
>1 : 1
f(a,b)
>f(a,b) : void
>f : (a: number, b: number) => void
>a : number
>b : number | undefined
// error
}
function func4( {a: {b, c}, d}: {a: {b: number,c?: number},d: number} = {a: {b: 1,c: 2},d: 3} ) {
>func4 : ({ a: { b, c }, d }?: { a: { b: number; c?: number | undefined; }; d: number; }) => void
>a : any
>b : number
>c : number | undefined
>d : number
>a : { b: number; c?: number | undefined; }
>b : number
>c : number | undefined
>d : number
>{a: {b: 1,c: 2},d: 3} : { a: { b: number; c: number; }; d: number; }
>a : { b: number; c: number; }
>{b: 1,c: 2} : { b: number; c: number; }
>b : number
>1 : 1
>c : number
>2 : 2
>d : number
>3 : 3
f(b,c)
>f(b,c) : void
>f : (a: number, b: number) => void
>b : number
>c : number | undefined
// error
}
function func5({a: {b, c = 4}, d}: {a: {b: number,c?: number},d: number} = {a: {b: 1,c: 2},d: 3} ) {
>func5 : ({ a: { b, c }, d }?: { a: { b: number; c?: number | undefined; }; d: number; }) => void
>a : any
>b : number
>c : number
>4 : 4
>d : number
>a : { b: number; c?: number | undefined; }
>b : number
>c : number | undefined
>d : number
>{a: {b: 1,c: 2},d: 3} : { a: { b: number; c: number; }; d: number; }
>a : { b: number; c: number; }
>{b: 1,c: 2} : { b: number; c: number; }
>b : number
>1 : 1
>c : number
>2 : 2
>d : number
>3 : 3
f(b, c)
>f(b, c) : void
>f : (a: number, b: number) => void
>b : number
>c : number
// no error
}
function func6( {a: {b, c} = {b: 4, c: 5}, d}: {a: {b: number, c?: number}, d: number} = {a: {b: 1,c: 2}, d: 3} ) {
>func6 : ({ a: { b, c }, d }?: { a: { b: number; c?: number | undefined; }; d: number; }) => void
>a : any
>b : number
>c : number | undefined
>{b: 4, c: 5} : { b: number; c: number; }
>b : number
>4 : 4
>c : number
>5 : 5
>d : number
>a : { b: number; c?: number | undefined; }
>b : number
>c : number | undefined
>d : number
>{a: {b: 1,c: 2}, d: 3} : { a: { b: number; c: number; }; d: number; }
>a : { b: number; c: number; }
>{b: 1,c: 2} : { b: number; c: number; }
>b : number
>1 : 1
>c : number
>2 : 2
>d : number
>3 : 3
f(b, c)
>f(b, c) : void
>f : (a: number, b: number) => void
>b : number
>c : number | undefined
// error
}
function func7( {a: {b, c = 6} = {b: 4, c: 5}, d}: {a: {b: number, c?: number}, d: number} = {a: {b: 1, c: 2}, d: 3} ) {
>func7 : ({ a: { b, c }, d }?: { a: { b: number; c?: number | undefined; }; d: number; }) => void
>a : any
>b : number
>c : number
>6 : 6
>{b: 4, c: 5} : { b: number; c?: number; }
>b : number
>4 : 4
>c : number
>5 : 5
>d : number
>a : { b: number; c?: number | undefined; }
>b : number
>c : number | undefined
>d : number
>{a: {b: 1, c: 2}, d: 3} : { a: { b: number; c: number; }; d: number; }
>a : { b: number; c: number; }
>{b: 1, c: 2} : { b: number; c: number; }
>b : number
>1 : 1
>c : number
>2 : 2
>d : number
>3 : 3
f(b, c)
>f(b, c) : void
>f : (a: number, b: number) => void
>b : number
>c : number
// no error
}
interface Foo {
>Foo : Foo
readonly bar?: number;
>bar : number | undefined
}
function performFoo({ bar }: Foo = {}) {
>performFoo : ({ bar }?: Foo) => void
>bar : number | undefined
>Foo : Foo
>{} : {}
useBar(bar);
>useBar(bar) : void
>useBar : (bar: number) => void
>bar : number | undefined
}
declare function useBar(bar: number): void;
>useBar : (bar: number) => void
>bar : number
performFoo();
>performFoo() : void
>performFoo : ({ bar }?: Foo) => void
function performFoo2({ bar = null }: Foo = {}) {
>performFoo2 : ({ bar }?: Foo) => void
>bar : number | null
>null : null
>Foo : Foo
>{} : {}
useBar2(bar);
>useBar2(bar) : void
>useBar2 : (bar: number | undefined) => void
>bar : number | null
}
declare function useBar2(bar: number | undefined): void;
>useBar2 : (bar: number | undefined) => void
>bar : number | undefined
performFoo2();
>performFoo2() : void
>performFoo2 : ({ bar }?: Foo) => void
@@ -1,6 +1,6 @@
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(27,5): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(41,11): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(63,1): error TS2558: Expected 1-3 type arguments, but got 4.
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(63,5): error TS2558: Expected 1-3 type arguments, but got 4.
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,21): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,21): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,5): error TS2344: Type 'boolean' does not satisfy the constraint 'number'.
@@ -78,7 +78,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22):
// Generic overloads with differing arity called with type argument count that doesn't match any overload
fn3<number, number, number, number>(); // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 1-3 type arguments, but got 4.
// Generic overloads with constraints called with type arguments that satisfy the constraints
@@ -1,7 +1,7 @@
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(27,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(60,1): error TS2558: Expected 3 type arguments, but got 1.
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(61,1): error TS2558: Expected 3 type arguments, but got 2.
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(65,1): error TS2558: Expected 3 type arguments, but got 4.
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(60,9): error TS2558: Expected 3 type arguments, but got 1.
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(61,9): error TS2558: Expected 3 type arguments, but got 2.
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(65,9): error TS2558: Expected 3 type arguments, but got 4.
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(73,25): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(74,9): error TS2344: Type 'number' does not satisfy the constraint 'string'.
tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(75,9): error TS2344: Type 'number' does not satisfy the constraint 'string'.
@@ -77,16 +77,16 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstru
// Generic overloads with differing arity called with type arguments matching each overload type parameter count
new fn3<number>(4); // Error
~~~~~~~~~~~~~~~~~~
~~~~~~
!!! error TS2558: Expected 3 type arguments, but got 1.
new fn3<string, string>('', '', ''); // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
!!! error TS2558: Expected 3 type arguments, but got 2.
new fn3<number, string, string>('', '', 3);
// Generic overloads with differing arity called with type argument count that doesn't match any overload
new fn3<number, number, number, number>(); // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 3 type arguments, but got 4.
// Generic overloads with constraints called with type arguments that satisfy the constraints
@@ -1,6 +1,6 @@
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(27,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(43,15): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(67,1): error TS2558: Expected 1-3 type arguments, but got 4.
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(67,9): error TS2558: Expected 1-3 type arguments, but got 4.
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,25): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,25): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,9): error TS2344: Type 'boolean' does not satisfy the constraint 'number'.
@@ -82,7 +82,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors
// Generic overloads with differing arity called with type argument count that doesn't match any overload
new fn3<number, number, number, number>(); // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 1-3 type arguments, but got 4.
// Generic overloads with constraints called with type arguments that satisfy the constraints
@@ -1,6 +1,6 @@
tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(5,1): error TS2558: Expected 0-2 type arguments, but got 3.
tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(5,11): error TS2558: Expected 0-2 type arguments, but got 3.
tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,1): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,1): error TS2558: Expected 0-2 type arguments, but got 3.
tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,15): error TS2558: Expected 0-2 type arguments, but got 3.
==== tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts (3 errors) ====
@@ -9,10 +9,10 @@ tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,1): error TS2558:
declare function Callbacks<T1, T2>(flags?: string): void;
Callbacks<number, string, boolean>('s'); // wrong number of type arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 0-2 type arguments, but got 3.
new Callbacks<number, string, boolean>('s'); // wrong number of type arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 0-2 type arguments, but got 3.
@@ -1,13 +1,13 @@
tests/cases/conformance/parser/ecmascript5/Generics/parserConstructorAmbiguity3.ts(1,1): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/parser/ecmascript5/Generics/parserConstructorAmbiguity3.ts(1,10): error TS2304: Cannot find name 'A'.
tests/cases/conformance/parser/ecmascript5/Generics/parserConstructorAmbiguity3.ts(1,10): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/conformance/parser/ecmascript5/Generics/parserConstructorAmbiguity3.ts(1,12): error TS1005: '(' expected.
==== tests/cases/conformance/parser/ecmascript5/Generics/parserConstructorAmbiguity3.ts (3 errors) ====
new Date<A>
~~~~~~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
~
!!! error TS2304: Cannot find name 'A'.
~
!!! error TS2558: Expected 0 type arguments, but got 1.
!!! error TS1005: '(' expected.
Loaded 100 of 158 files, more files were not shown because too many files have changed in this diff. Show more