mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into rootDir
This commit is contained in:
@@ -15,7 +15,11 @@ Please help us by doing the following steps before logging an issue:
|
||||
Please fill in the *entire* template below.
|
||||
-->
|
||||
|
||||
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
|
||||
<!--
|
||||
Please try to reproduce the issue with the latest published version. It may have already been fixed.
|
||||
For npm: `typescript@next`
|
||||
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly
|
||||
-->
|
||||
**TypeScript Version:** 3.7.x-dev.201xxxxx
|
||||
|
||||
<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
|
||||
|
||||
@@ -251,9 +251,7 @@ namespace ts {
|
||||
state.seenAffectedFiles = createMap<true>();
|
||||
}
|
||||
|
||||
state.emittedBuildInfo = !state.changedFilesSet.size &&
|
||||
!state.affectedFilesPendingEmit;
|
||||
|
||||
state.emittedBuildInfo = !state.changedFilesSet.size && !state.affectedFilesPendingEmit;
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
+27
-23
@@ -174,12 +174,6 @@ namespace ts {
|
||||
IsForSignatureHelp = 1 << 4, // Call resolution for purposes of signature help
|
||||
}
|
||||
|
||||
const enum ContextFlags {
|
||||
None = 0,
|
||||
Signature = 1 << 0, // Obtaining contextual signature
|
||||
NoConstraints = 1 << 1, // Don't obtain type variable constraints
|
||||
}
|
||||
|
||||
const enum AccessFlags {
|
||||
None = 0,
|
||||
NoIndexSignatures = 1 << 0,
|
||||
@@ -454,9 +448,9 @@ namespace ts {
|
||||
},
|
||||
getAugmentedPropertiesOfType,
|
||||
getRootSymbols,
|
||||
getContextualType: nodeIn => {
|
||||
getContextualType: (nodeIn: Expression, contextFlags?: ContextFlags) => {
|
||||
const node = getParseTreeNode(nodeIn, isExpression);
|
||||
return node ? getContextualType(node) : undefined;
|
||||
return node ? getContextualType(node, contextFlags) : undefined;
|
||||
},
|
||||
getContextualTypeForObjectLiteralElement: nodeIn => {
|
||||
const node = getParseTreeNode(nodeIn, isObjectLiteralElementLike);
|
||||
@@ -10746,7 +10740,7 @@ namespace ts {
|
||||
errorType;
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.Value && isJSDocTypeReference(node)) {
|
||||
const jsdocType = getTypeFromJSAlias(node, symbol);
|
||||
const jsdocType = getTypeFromJSDocValueReference(node, symbol);
|
||||
if (jsdocType) {
|
||||
return jsdocType;
|
||||
}
|
||||
@@ -10760,19 +10754,25 @@ namespace ts {
|
||||
}
|
||||
|
||||
/**
|
||||
* A JSdoc TypeReference may be to a value imported from commonjs.
|
||||
* These should really be aliases, but this special-case code fakes alias resolution
|
||||
* by producing a type from a value.
|
||||
* A JSdoc TypeReference may be to a value, but resolve it as a type anyway.
|
||||
* Note: If the value is imported from commonjs, it should really be an alias,
|
||||
* but this function fakes special-case code fakes alias resolution as well.
|
||||
*/
|
||||
function getTypeFromJSAlias(node: NodeWithTypeArguments, symbol: Symbol): Type | undefined {
|
||||
function getTypeFromJSDocValueReference(node: NodeWithTypeArguments, symbol: Symbol): Type | undefined {
|
||||
const valueType = getTypeOfSymbol(symbol);
|
||||
const typeType =
|
||||
valueType.symbol &&
|
||||
valueType.symbol !== symbol && // Make sure this is a commonjs export by checking that symbol -> type -> symbol doesn't roundtrip.
|
||||
getTypeReferenceType(node, valueType.symbol);
|
||||
if (typeType) {
|
||||
return getSymbolLinks(symbol).resolvedJSDocType = typeType;
|
||||
let typeType = valueType;
|
||||
if (symbol.valueDeclaration) {
|
||||
const decl = getRootDeclaration(symbol.valueDeclaration);
|
||||
const isRequireAlias = isVariableDeclaration(decl)
|
||||
&& decl.initializer
|
||||
&& isCallExpression(decl.initializer)
|
||||
&& isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
if (isRequireAlias) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
return getSymbolLinks(symbol).resolvedJSDocType = typeType;
|
||||
}
|
||||
|
||||
function getSubstitutionType(typeVariable: TypeVariable, substitute: Type) {
|
||||
@@ -20948,19 +20948,23 @@ namespace ts {
|
||||
}
|
||||
|
||||
// In a typed function call, an argument or substitution expression is contextually typed by the type of the corresponding parameter.
|
||||
function getContextualTypeForArgument(callTarget: CallLikeExpression, arg: Expression): Type | undefined {
|
||||
function getContextualTypeForArgument(callTarget: CallLikeExpression, arg: Expression, contextFlags?: ContextFlags): Type | undefined {
|
||||
const args = getEffectiveCallArguments(callTarget);
|
||||
const argIndex = args.indexOf(arg); // -1 for e.g. the expression of a CallExpression, or the tag of a TaggedTemplateExpression
|
||||
return argIndex === -1 ? undefined : getContextualTypeForArgumentAtIndex(callTarget, argIndex);
|
||||
return argIndex === -1 ? undefined : getContextualTypeForArgumentAtIndex(callTarget, argIndex, contextFlags);
|
||||
}
|
||||
|
||||
function getContextualTypeForArgumentAtIndex(callTarget: CallLikeExpression, argIndex: number): Type {
|
||||
function getContextualTypeForArgumentAtIndex(callTarget: CallLikeExpression, argIndex: number, contextFlags?: ContextFlags): Type {
|
||||
// If we're already in the process of resolving the given signature, don't resolve again as
|
||||
// that could cause infinite recursion. Instead, return anySignature.
|
||||
const signature = getNodeLinks(callTarget).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(callTarget);
|
||||
if (isJsxOpeningLikeElement(callTarget) && argIndex === 0) {
|
||||
return getEffectiveFirstArgumentForJsxSignature(signature, callTarget);
|
||||
}
|
||||
if (contextFlags && contextFlags & ContextFlags.Completion && signature.target) {
|
||||
const baseSignature = getBaseSignature(signature.target);
|
||||
return intersectTypes(getTypeAtPosition(signature, argIndex), getTypeAtPosition(baseSignature, argIndex));
|
||||
}
|
||||
return getTypeAtPosition(signature, argIndex);
|
||||
}
|
||||
|
||||
@@ -21352,7 +21356,7 @@ namespace ts {
|
||||
}
|
||||
/* falls through */
|
||||
case SyntaxKind.NewExpression:
|
||||
return getContextualTypeForArgument(<CallExpression | NewExpression>parent, node);
|
||||
return getContextualTypeForArgument(<CallExpression | NewExpression>parent, node, contextFlags);
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.AsExpression:
|
||||
return isConstTypeReference((<AssertionExpression>parent).type) ? undefined : getTypeFromTypeNode((<AssertionExpression>parent).type);
|
||||
|
||||
@@ -1811,7 +1811,7 @@ namespace ts {
|
||||
const node = <ForOfStatement>createSynthesizedNode(SyntaxKind.ForOfStatement);
|
||||
node.awaitModifier = awaitModifier;
|
||||
node.initializer = initializer;
|
||||
node.expression = expression;
|
||||
node.expression = isCommaSequence(expression) ? createParen(expression) : expression;
|
||||
node.statement = asEmbeddedStatement(statement);
|
||||
return node;
|
||||
}
|
||||
@@ -4739,7 +4739,7 @@ namespace ts {
|
||||
const conditionalPrecedence = getOperatorPrecedence(SyntaxKind.ConditionalExpression, SyntaxKind.QuestionToken);
|
||||
const emittedCondition = skipPartiallyEmittedExpressions(condition);
|
||||
const conditionPrecedence = getExpressionPrecedence(emittedCondition);
|
||||
if (compareValues(conditionPrecedence, conditionalPrecedence) === Comparison.LessThan) {
|
||||
if (compareValues(conditionPrecedence, conditionalPrecedence) !== Comparison.GreaterThan) {
|
||||
return createParen(condition);
|
||||
}
|
||||
return condition;
|
||||
|
||||
@@ -3371,8 +3371,10 @@ namespace ts {
|
||||
|
||||
getFullyQualifiedName(symbol: Symbol): string;
|
||||
getAugmentedPropertiesOfType(type: Type): Symbol[];
|
||||
|
||||
getRootSymbols(symbol: Symbol): readonly Symbol[];
|
||||
getContextualType(node: Expression): Type | undefined;
|
||||
/* @internal */ getContextualType(node: Expression, contextFlags?: ContextFlags): Type | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
|
||||
/* @internal */ getContextualTypeForObjectLiteralElement(element: ObjectLiteralElementLike): Type | undefined;
|
||||
/* @internal */ getContextualTypeForArgumentAtIndex(call: CallLikeExpression, argIndex: number): Type | undefined;
|
||||
/* @internal */ getContextualTypeForJsxAttribute(attribute: JsxAttribute | JsxSpreadAttribute): Type | undefined;
|
||||
@@ -3532,6 +3534,14 @@ namespace ts {
|
||||
Subtype
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum ContextFlags {
|
||||
None = 0,
|
||||
Signature = 1 << 0, // Obtaining contextual signature
|
||||
NoConstraints = 1 << 1, // Don't obtain type variable constraints
|
||||
Completion = 1 << 2, // Obtaining constraint type for completion
|
||||
}
|
||||
|
||||
// NOTE: If modifying this enum, must modify `TypeFormatFlags` too!
|
||||
export const enum NodeBuilderFlags {
|
||||
None = 0,
|
||||
|
||||
@@ -1819,9 +1819,9 @@ namespace ts {
|
||||
* exactly one argument (of the form 'require("name")').
|
||||
* This function does not test if the node is in a JavaScript file or not.
|
||||
*/
|
||||
export function isRequireCall(callExpression: Node, checkArgumentIsStringLiteralLike: true): callExpression is RequireOrImportCall & { expression: Identifier, arguments: [StringLiteralLike] };
|
||||
export function isRequireCall(callExpression: Node, checkArgumentIsStringLiteralLike: boolean): callExpression is CallExpression;
|
||||
export function isRequireCall(callExpression: Node, checkArgumentIsStringLiteralLike: boolean): callExpression is CallExpression {
|
||||
export function isRequireCall(callExpression: Node, requireStringLiteralLikeArgument: true): callExpression is RequireOrImportCall & { expression: Identifier, arguments: [StringLiteralLike] };
|
||||
export function isRequireCall(callExpression: Node, requireStringLiteralLikeArgument: boolean): callExpression is CallExpression;
|
||||
export function isRequireCall(callExpression: Node, requireStringLiteralLikeArgument: boolean): callExpression is CallExpression {
|
||||
if (callExpression.kind !== SyntaxKind.CallExpression) {
|
||||
return false;
|
||||
}
|
||||
@@ -1835,7 +1835,7 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
const arg = args[0];
|
||||
return !checkArgumentIsStringLiteralLike || isStringLiteralLike(arg);
|
||||
return !requireStringLiteralLikeArgument || isStringLiteralLike(arg);
|
||||
}
|
||||
|
||||
export function isSingleOrDoubleQuote(charCode: number) {
|
||||
|
||||
@@ -775,7 +775,9 @@ namespace FourSlash {
|
||||
private verifyCompletionsWorker(options: FourSlashInterface.VerifyCompletionsOptions): void {
|
||||
const actualCompletions = this.getCompletionListAtCaret({ ...options.preferences, triggerCharacter: options.triggerCharacter })!;
|
||||
if (!actualCompletions) {
|
||||
if (ts.hasProperty(options, "exact") && options.exact === undefined) return;
|
||||
if (ts.hasProperty(options, "exact") && (options.exact === undefined || ts.isArray(options.exact) && !options.exact.length)) {
|
||||
return;
|
||||
}
|
||||
this.raiseError(`No completions at position '${this.currentCaretPosition}'.`);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -9762,7 +9762,7 @@ interface ImageData {
|
||||
declare var ImageData: {
|
||||
prototype: ImageData;
|
||||
new(width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height?: number): ImageData;
|
||||
};
|
||||
|
||||
interface InnerHTML {
|
||||
|
||||
Vendored
+6
-6
@@ -873,12 +873,12 @@ interface DateConstructor {
|
||||
/**
|
||||
* Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
|
||||
* @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
|
||||
* @param month The month as an number between 0 and 11 (January to December).
|
||||
* @param date The date as an number between 1 and 31.
|
||||
* @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour.
|
||||
* @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes.
|
||||
* @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds.
|
||||
* @param ms An number from 0 to 999 that specifies the milliseconds.
|
||||
* @param month The month as a number between 0 and 11 (January to December).
|
||||
* @param date The date as a number between 1 and 31.
|
||||
* @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
|
||||
* @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
|
||||
* @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
|
||||
* @param ms A number from 0 to 999 that specifies the milliseconds.
|
||||
*/
|
||||
UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
|
||||
now(): number;
|
||||
|
||||
Vendored
+1
-1
@@ -2202,7 +2202,7 @@ interface ImageData {
|
||||
declare var ImageData: {
|
||||
prototype: ImageData;
|
||||
new(width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height?: number): ImageData;
|
||||
};
|
||||
|
||||
/** This Channel Messaging API interface allows us to create a new message channel and send data through it via its two MessagePort properties. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LCX SchemaVersion="6.0" Name="f:\ddSetup\sources\typescript\localization\compiler2.resx" PsrId="306" FileType="1" SrcCul="en-US" TgtCul="fr-FR" xmlns="http://schemas.microsoft.com/locstudio/2006/6/lcx">
|
||||
<Props>
|
||||
<Str Name="CustomName1" Val="Custom 1" />
|
||||
@@ -1348,7 +1348,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[An export assignment can only be used in a module.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Une attribution d'exportation peut uniquement être utilisée dans un module.]]></Val>
|
||||
<Val><![CDATA[Une affectation d'exportation peut uniquement être utilisée dans un module.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -5539,7 +5539,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not all code paths return a value.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Les chemins de code ne retournent pas tous une valeur.]]></Val>
|
||||
<Val><![CDATA[Les chemins du code ne retournent pas tous une valeur.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -6916,7 +6916,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Report error when not all code paths in function return a value.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Signalez une erreur quand les chemins de code de la fonction ne retournent pas tous une valeur.]]></Val>
|
||||
<Val><![CDATA[Signalez une erreur quand les chemins du code de la fonction ne retournent pas tous une valeur.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -1228,7 +1228,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[An AMD module cannot have multiple name assignments.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[AMD モジュールに複数の名前を割り当てることはできません。]]></Val>
|
||||
<Val><![CDATA[AMD モジュールに複数の名前を代入することはできません。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -1336,7 +1336,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[An export assignment can only be used in a module.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[エクスポートの割り当てはモジュールでのみ使用可能です。]]></Val>
|
||||
<Val><![CDATA[エクスポートの代入はモジュールでのみ使用可能です。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -1345,7 +1345,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[An export assignment cannot be used in a module with other exported elements.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[エクスポートの割り当ては、エクスポートされた他の要素を含むモジュールでは使用できません。]]></Val>
|
||||
<Val><![CDATA[エクスポートの代入は、エクスポートされた他の要素を含むモジュールでは使用できません。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -1354,7 +1354,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[An export assignment cannot be used in a namespace.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[エクスポートの割り当ては、名前空間では使用できません。]]></Val>
|
||||
<Val><![CDATA[エクスポートの代入は、名前空間では使用できません。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -1363,7 +1363,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[An export assignment cannot have modifiers.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[エクスポートの割り当てに修飾子を指定することはできません。]]></Val>
|
||||
<Val><![CDATA[エクスポートの代入に修飾子を指定することはできません。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -3610,7 +3610,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[ECMAScript モジュールを対象にする場合は、エクスポート割り当てを使用できません。代わりに 'export default' または別のモジュール書式の使用をご検討ください。]]></Val>
|
||||
<Val><![CDATA[ECMAScript モジュールを対象にする場合は、エクスポート代入を使用できません。代わりに 'export default' または別のモジュール書式の使用をご検討ください。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -3619,7 +3619,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Export assignment is not supported when '--module' flag is 'system'.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[割り当てのエクスポートは、'--module' フラグが 'system' の場合にはサポートされません。]]></Val>
|
||||
<Val><![CDATA[代入のエクスポートは、'--module' フラグが 'system' の場合にはサポートされません。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -3703,7 +3703,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Exports and export assignments are not permitted in module augmentations.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[エクスポートとエクスポートの割り当てはモジュールの拡張では許可されていません。]]></Val>
|
||||
<Val><![CDATA[エクスポートとエクスポートの代入はモジュールの拡張では許可されていません。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -4390,7 +4390,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[ECMAScript モジュールを対象にする場合は、インポート割り当てを使用できません。代わりに 'import * as ns from "mod"'、'import {a} from "mod"'、'import d from "mod"' などのモジュール書式の使用をご検討ください。]]></Val>
|
||||
<Val><![CDATA[ECMAScript モジュールを対象にする場合は、インポート代入を使用できません。代わりに 'import * as ns from "mod"'、'import {a} from "mod"'、'import d from "mod"' などのモジュール書式の使用をご検討ください。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -6622,7 +6622,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Property assignment expected.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[プロパティの割り当てが必要です。]]></Val>
|
||||
<Val><![CDATA[プロパティの代入が必要です。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -7870,7 +7870,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[The expression of an export assignment must be an identifier or qualified name in an ambient context.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[エクスポートの割り当ての式は、環境コンテキストの識別子または修飾名にする必要があります。]]></Val>
|
||||
<Val><![CDATA[エクスポートの代入の式は、環境コンテキストの識別子または修飾名にする必要があります。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -8170,7 +8170,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[The target of an object rest assignment must be a variable or a property access.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[オブジェクトの残り部分の割り当ての対象は、変数またはプロパティ アクセスである必要があります。]]></Val>
|
||||
<Val><![CDATA[オブジェクトの残り部分の代入の対象は、変数またはプロパティ アクセスである必要があります。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -9535,7 +9535,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA['=' can only be used in an object literal property inside a destructuring assignment.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA['=' は、非構造化割り当て内のオブジェクト リテラル プロパティでのみ使用できます。]]></Val>
|
||||
<Val><![CDATA['=' は、非構造化代入内のオブジェクト リテラル プロパティでのみ使用できます。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
@@ -9601,7 +9601,7 @@
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA['const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA['const' 列挙型は、プロパティまたはインデックスのアクセス式、インポート宣言またはエクスポートの割り当ての右辺、型のクエリにのみ使用できます。]]></Val>
|
||||
<Val><![CDATA['const' 列挙型は、プロパティまたはインデックスのアクセス式、インポート宣言またはエクスポートの代入の右辺、型のクエリにのみ使用できます。]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA['const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.]]></Val>
|
||||
|
||||
@@ -1000,6 +1000,7 @@ namespace ts.Completions {
|
||||
let completionKind = CompletionKind.None;
|
||||
let isNewIdentifierLocation = false;
|
||||
let keywordFilters = KeywordCompletionFilters.None;
|
||||
// This also gets mutated in nested-functions after the return
|
||||
let symbols: Symbol[] = [];
|
||||
const symbolToOriginInfoMap: SymbolOriginInfoMap = [];
|
||||
const symbolToSortTextMap: SymbolSortTextMap = [];
|
||||
@@ -1464,7 +1465,7 @@ namespace ts.Completions {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gathers symbols that can be imported from other files, deduplicating along the way. Symbols can be “duplicates”
|
||||
* Gathers symbols that can be imported from other files, de-duplicating along the way. Symbols can be "duplicates"
|
||||
* if re-exported from another module, e.g. `export { foo } from "./a"`. That syntax creates a fresh symbol, but
|
||||
* it’s just an alias to the first, and both have the same name, so we generally want to filter those aliases out,
|
||||
* if and only if the the first can be imported (it may be excluded due to package.json filtering in
|
||||
@@ -1548,7 +1549,7 @@ namespace ts.Completions {
|
||||
// Don't add another completion for `export =` of a symbol that's already global.
|
||||
// So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`.
|
||||
if (resolvedModuleSymbol !== moduleSymbol &&
|
||||
every(resolvedModuleSymbol.declarations, d => !!d.getSourceFile().externalModuleIndicator)) {
|
||||
every(resolvedModuleSymbol.declarations, d => !!d.getSourceFile().externalModuleIndicator && !findAncestor(d, isGlobalScopeAugmentation))) {
|
||||
pushSymbol(resolvedModuleSymbol, moduleSymbol, /*skipFilter*/ true);
|
||||
}
|
||||
|
||||
@@ -1760,7 +1761,7 @@ namespace ts.Completions {
|
||||
let existingMembers: readonly Declaration[] | undefined;
|
||||
|
||||
if (objectLikeContainer.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
const typeForObject = typeChecker.getContextualType(objectLikeContainer);
|
||||
const typeForObject = typeChecker.getContextualType(objectLikeContainer, ContextFlags.Completion);
|
||||
if (!typeForObject) return GlobalsSearch.Fail;
|
||||
isNewIdentifierLocation = hasIndexSignature(typeForObject);
|
||||
typeMembers = getPropertiesForObjectExpression(typeForObject, objectLikeContainer, typeChecker);
|
||||
|
||||
@@ -158,25 +158,6 @@ namespace ts.JsDoc {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates through 'array' by index and performs the callback on each element of array until the callback
|
||||
* returns a truthy value, then returns that value.
|
||||
* If no such value is found, the callback is applied to each element of array and undefined is returned.
|
||||
*/
|
||||
function forEachUnique<T, U>(array: readonly T[] | undefined, callback: (element: T, index: number) => U): U | undefined {
|
||||
if (array) {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
if (array.indexOf(array[i]) === i) {
|
||||
const result = callback(array[i], i);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getJSDocTagNameCompletions(): CompletionEntry[] {
|
||||
return jsDocTagNameCompletionEntries || (jsDocTagNameCompletionEntries = map(jsDocTagNames, tagName => {
|
||||
return {
|
||||
|
||||
@@ -527,11 +527,11 @@ namespace ts {
|
||||
|
||||
let doc = JsDoc.getJsDocCommentsFromDeclarations(declarations);
|
||||
if (doc.length === 0 || declarations.some(hasJSDocInheritDocTag)) {
|
||||
for (const declaration of declarations) {
|
||||
forEachUnique(declarations, declaration => {
|
||||
const inheritedDocs = findInheritedJSDocComments(declaration, declaration.symbol.name, checker!); // TODO: GH#18217
|
||||
// TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
|
||||
if (inheritedDocs) doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(lineBreakPart(), doc);
|
||||
}
|
||||
});
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace ts.SymbolDisplay {
|
||||
// get the signature from the declaration and write it
|
||||
const functionDeclaration = <FunctionLike>location.parent;
|
||||
// Use function declaration to write the signatures only if the symbol corresponding to this declaration
|
||||
const locationIsSymbolDeclaration = find(symbol.declarations, declaration =>
|
||||
const locationIsSymbolDeclaration = symbol.declarations && find(symbol.declarations, declaration =>
|
||||
declaration === (location.kind === SyntaxKind.ConstructorKeyword ? functionDeclaration.parent : functionDeclaration));
|
||||
|
||||
if (locationIsSymbolDeclaration) {
|
||||
|
||||
@@ -1458,6 +1458,25 @@ namespace ts {
|
||||
export function documentSpansEqual(a: DocumentSpan, b: DocumentSpan): boolean {
|
||||
return a.fileName === b.fileName && textSpansEqual(a.textSpan, b.textSpan);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates through 'array' by index and performs the callback on each element of array until the callback
|
||||
* returns a truthy value, then returns that value.
|
||||
* If no such value is found, the callback is applied to each element of array and undefined is returned.
|
||||
*/
|
||||
export function forEachUnique<T, U>(array: readonly T[] | undefined, callback: (element: T, index: number) => U): U | undefined {
|
||||
if (array) {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
if (array.indexOf(array[i]) === i) {
|
||||
const result = callback(array[i], i);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// Display-part writer helpers
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace ts {
|
||||
|
||||
verifyTsc({
|
||||
scenario: "demo",
|
||||
subScenario: "in master branch with everything setup correctly, reports no error",
|
||||
subScenario: "in master branch with everything setup correctly and reports no error",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"]
|
||||
});
|
||||
|
||||
@@ -10,14 +10,14 @@ namespace ts {
|
||||
|
||||
verifyTsc({
|
||||
scenario: "emptyFiles",
|
||||
subScenario: "does not have empty files diagnostic when files is empty and references are provided",
|
||||
subScenario: "has empty files diagnostic when files is empty and no references are provided",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/no-references"],
|
||||
});
|
||||
|
||||
verifyTsc({
|
||||
scenario: "emptyFiles",
|
||||
subScenario: "has empty files diagnostic when files is empty and no references are provided",
|
||||
subScenario: "does not have empty files diagnostic when files is empty and references are provided",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/with-references"],
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace ts {
|
||||
|
||||
sys.write(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}\n`);
|
||||
sys.exit = exitCode => sys.exitCode = exitCode;
|
||||
ts.executeCommandLine(
|
||||
executeCommandLine(
|
||||
sys,
|
||||
{
|
||||
onCompilerHostCreate: host => fakes.patchHostForBuildInfoReadWrite(host),
|
||||
|
||||
@@ -37,6 +37,24 @@ namespace ts {
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "incremental",
|
||||
subScenario: "with only dts files",
|
||||
fs: () => loadProjectFromFiles({
|
||||
"/src/project/src/main.d.ts": "export const x = 10;",
|
||||
"/src/project/src/another.d.ts": "export const y = 10;",
|
||||
"/src/project/tsconfig.json": "{}",
|
||||
}),
|
||||
commandLineArgs: ["--incremental", "--p", "src/project"],
|
||||
incrementalScenarios: [
|
||||
noChangeRun,
|
||||
{
|
||||
buildKind: BuildKind.IncrementalDtsUnchanged,
|
||||
modifyFs: fs => appendText(fs, "/src/project/src/main.d.ts", "export const xy = 100;")
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "incremental",
|
||||
subScenario: "when passing rootDir is in the tsconfig",
|
||||
|
||||
@@ -604,8 +604,8 @@ namespace ts {
|
||||
createWatchProgram(watchCompilerHost);
|
||||
}
|
||||
|
||||
function canReportDiagnostics(sys: System, compilerOptions: CompilerOptions) {
|
||||
return sys === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
|
||||
function canReportDiagnostics(system: System, compilerOptions: CompilerOptions) {
|
||||
return system === sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
|
||||
}
|
||||
|
||||
function enableStatistics(sys: System, compilerOptions: CompilerOptions) {
|
||||
|
||||
@@ -5,7 +5,6 @@ tests/cases/compiler/index4.js(2,19): error TS2315: Type 'Function' is not gener
|
||||
tests/cases/compiler/index5.js(2,19): error TS2315: Type 'String' is not generic.
|
||||
tests/cases/compiler/index6.js(2,19): error TS2315: Type 'Number' is not generic.
|
||||
tests/cases/compiler/index7.js(2,19): error TS2315: Type 'Object' is not generic.
|
||||
tests/cases/compiler/index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here.
|
||||
tests/cases/compiler/index8.js(4,15): error TS2304: Cannot find name 'T'.
|
||||
|
||||
|
||||
@@ -84,13 +83,11 @@ tests/cases/compiler/index8.js(4,15): error TS2304: Cannot find name 'T'.
|
||||
return 'Hello ' + somebody;
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/index8.js (2 errors) ====
|
||||
==== tests/cases/compiler/index8.js (1 errors) ====
|
||||
function fn() {}
|
||||
|
||||
/**
|
||||
* @param {fn<T>} somebody
|
||||
~~
|
||||
!!! error TS2749: 'fn' refers to a value, but is being used as a type here.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
*/
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
tests/cases/conformance/jsdoc/bug27342.js(3,11): error TS2709: Cannot use namespace 'exports' as a type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsdoc/bug27342.js (1 errors) ====
|
||||
module.exports = {}
|
||||
/**
|
||||
* @type {exports}
|
||||
~~~~~~~
|
||||
!!! error TS2709: Cannot use namespace 'exports' as a type.
|
||||
*/
|
||||
var x
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/conformance/jsdoc/foo.js ===
|
||||
/** @param {Image} image */
|
||||
function process(image) {
|
||||
>process : Symbol(process, Decl(foo.js, 0, 0))
|
||||
>image : Symbol(image, Decl(foo.js, 1, 17))
|
||||
|
||||
return new image(1, 1)
|
||||
>image : Symbol(image, Decl(foo.js, 1, 17))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/jsdoc/foo.js ===
|
||||
/** @param {Image} image */
|
||||
function process(image) {
|
||||
>process : (image: new (width?: number, height?: number) => HTMLImageElement) => HTMLImageElement
|
||||
>image : new (width?: number, height?: number) => HTMLImageElement
|
||||
|
||||
return new image(1, 1)
|
||||
>new image(1, 1) : HTMLImageElement
|
||||
>image : new (width?: number, height?: number) => HTMLImageElement
|
||||
>1 : 1
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [nullishCoalescingOperator12.ts]
|
||||
const obj: { arr: any[] } = { arr: [] };
|
||||
for (const i of obj?.arr ?? []) { }
|
||||
|
||||
|
||||
//// [nullishCoalescingOperator12.js]
|
||||
"use strict";
|
||||
var _a, _b;
|
||||
const obj = { arr: [] };
|
||||
for (const i of (_b = (_a = obj) === null || _a === void 0 ? void 0 : _a.arr, (_b !== null && _b !== void 0 ? _b : []))) { }
|
||||
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator12.ts ===
|
||||
const obj: { arr: any[] } = { arr: [] };
|
||||
>obj : Symbol(obj, Decl(nullishCoalescingOperator12.ts, 0, 5))
|
||||
>arr : Symbol(arr, Decl(nullishCoalescingOperator12.ts, 0, 12))
|
||||
>arr : Symbol(arr, Decl(nullishCoalescingOperator12.ts, 0, 29))
|
||||
|
||||
for (const i of obj?.arr ?? []) { }
|
||||
>i : Symbol(i, Decl(nullishCoalescingOperator12.ts, 1, 10))
|
||||
>obj?.arr : Symbol(arr, Decl(nullishCoalescingOperator12.ts, 0, 12))
|
||||
>obj : Symbol(obj, Decl(nullishCoalescingOperator12.ts, 0, 5))
|
||||
>arr : Symbol(arr, Decl(nullishCoalescingOperator12.ts, 0, 12))
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator12.ts ===
|
||||
const obj: { arr: any[] } = { arr: [] };
|
||||
>obj : { arr: any[]; }
|
||||
>arr : any[]
|
||||
>{ arr: [] } : { arr: never[]; }
|
||||
>arr : never[]
|
||||
>[] : never[]
|
||||
|
||||
for (const i of obj?.arr ?? []) { }
|
||||
>i : any
|
||||
>obj?.arr ?? [] : any[]
|
||||
>obj?.arr : any[]
|
||||
>obj : { arr: any[]; }
|
||||
>arr : any[]
|
||||
>[] : never[]
|
||||
|
||||
@@ -16,14 +16,19 @@ o5.b?.().c.d?.e;
|
||||
|
||||
// GH#33744
|
||||
declare const o6: <T>() => undefined | ({ x: number });
|
||||
o6<number>()?.x;
|
||||
o6<number>()?.x;
|
||||
|
||||
// GH#34109
|
||||
o1?.b ? 1 : 0;
|
||||
|
||||
//// [propertyAccessChain.js]
|
||||
"use strict";
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
||||
(_a = o1) === null || _a === void 0 ? void 0 : _a.b;
|
||||
(_b = o2) === null || _b === void 0 ? void 0 : _b.b.c;
|
||||
(_c = o3.b) === null || _c === void 0 ? void 0 : _c.c;
|
||||
(_e = (_d = o4.b) === null || _d === void 0 ? void 0 : _d.c.d) === null || _e === void 0 ? void 0 : _e.e;
|
||||
(_h = (_g = (_f = o5).b) === null || _g === void 0 ? void 0 : _g.call(_f).c.d) === null || _h === void 0 ? void 0 : _h.e;
|
||||
(_j = o6()) === null || _j === void 0 ? void 0 : _j.x;
|
||||
// GH#34109
|
||||
((_k = o1) === null || _k === void 0 ? void 0 : _k.b) ? 1 : 0;
|
||||
|
||||
@@ -79,3 +79,9 @@ o6<number>()?.x;
|
||||
>o6 : Symbol(o6, Decl(propertyAccessChain.ts, 16, 13))
|
||||
>x : Symbol(x, Decl(propertyAccessChain.ts, 16, 41))
|
||||
|
||||
// GH#34109
|
||||
o1?.b ? 1 : 0;
|
||||
>o1?.b : Symbol(b, Decl(propertyAccessChain.ts, 0, 31))
|
||||
>o1 : Symbol(o1, Decl(propertyAccessChain.ts, 0, 13))
|
||||
>b : Symbol(b, Decl(propertyAccessChain.ts, 0, 31))
|
||||
|
||||
|
||||
@@ -80,3 +80,12 @@ o6<number>()?.x;
|
||||
>o6 : <T>() => { x: number; } | undefined
|
||||
>x : number | undefined
|
||||
|
||||
// GH#34109
|
||||
o1?.b ? 1 : 0;
|
||||
>o1?.b ? 1 : 0 : 0 | 1
|
||||
>o1?.b : string | undefined
|
||||
>o1 : { b: string; } | undefined
|
||||
>b : string | undefined
|
||||
>1 : 1
|
||||
>0 : 0
|
||||
|
||||
|
||||
+46
-3
@@ -1,6 +1,49 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/no-references
|
||||
src/no-references/tsconfig.json(3,14): error TS18002: The 'files' list in config file '/src/no-references/tsconfig.json' is empty.
|
||||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
|
||||
/lib/tsc --b /src/with-references
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/core/index.d.ts]
|
||||
export declare function multiply(a: number, b: number): number;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
|
||||
//// [/src/core/index.d.ts.map]
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"}
|
||||
|
||||
//// [/src/core/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function multiply(a, b) { return a * b; }
|
||||
exports.multiply = multiply;
|
||||
|
||||
|
||||
//// [/src/core/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./index.ts": {
|
||||
"version": "5112841898-export function multiply(a: number, b: number) { return a * b; }\r\n",
|
||||
"signature": "3361149553-export declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./index.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
|
||||
+3
-46
@@ -1,49 +1,6 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/with-references
|
||||
exitCode:: ExitStatus.Success
|
||||
/lib/tsc --b /src/no-references
|
||||
src/no-references/tsconfig.json(3,14): error TS18002: The 'files' list in config file '/src/no-references/tsconfig.json' is empty.
|
||||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
|
||||
|
||||
|
||||
//// [/src/core/index.d.ts]
|
||||
export declare function multiply(a: number, b: number): number;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
|
||||
//// [/src/core/index.d.ts.map]
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"}
|
||||
|
||||
//// [/src/core/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function multiply(a, b) { return a * b; }
|
||||
exports.multiply = multiply;
|
||||
|
||||
|
||||
//// [/src/core/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./index.ts": {
|
||||
"version": "5112841898-export function multiply(a: number, b: number) { return a * b; }\r\n",
|
||||
"signature": "3361149553-export declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./index.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
//// [/lib/incremental-declaration-doesnt-changeOutput.txt]
|
||||
/lib/tsc --incremental --p src/project
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/project/src/main.d.ts]
|
||||
export const x = 10;export const xy = 100;
|
||||
|
||||
//// [/src/project/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./src/another.d.ts": {
|
||||
"version": "-13729955264-export const y = 10;",
|
||||
"signature": "-13729955264-export const y = 10;"
|
||||
},
|
||||
"./src/main.d.ts": {
|
||||
"version": "-10808461502-export const x = 10;export const xy = 100;",
|
||||
"signature": "-10808461502-export const x = 10;export const xy = 100;"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"incremental": true,
|
||||
"project": "./",
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./src/another.d.ts",
|
||||
"./src/main.d.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --incremental --p src/project
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/project/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./src/another.d.ts": {
|
||||
"version": "-13729955264-export const y = 10;",
|
||||
"signature": "-13729955264-export const y = 10;"
|
||||
},
|
||||
"./src/main.d.ts": {
|
||||
"version": "-10726455937-export const x = 10;",
|
||||
"signature": "-10726455937-export const x = 10;"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"incremental": true,
|
||||
"project": "./",
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./src/another.d.ts",
|
||||
"./src/main.d.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [/lib/no-change-runOutput.txt]
|
||||
/lib/tsc --incremental --p src/project
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// @strict: true
|
||||
// @target: ES2015
|
||||
|
||||
const obj: { arr: any[] } = { arr: [] };
|
||||
for (const i of obj?.arr ?? []) { }
|
||||
+4
-1
@@ -17,4 +17,7 @@ o5.b?.().c.d?.e;
|
||||
|
||||
// GH#33744
|
||||
declare const o6: <T>() => undefined | ({ x: number });
|
||||
o6<number>()?.x;
|
||||
o6<number>()?.x;
|
||||
|
||||
// GH#34109
|
||||
o1?.b ? 1 : 0;
|
||||
@@ -0,0 +1,8 @@
|
||||
// @Filename: foo.js
|
||||
// @noEmit: true
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
/** @param {Image} image */
|
||||
function process(image) {
|
||||
return new image(1, 1)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @strict: true
|
||||
|
||||
////function f<T>(x: T) {
|
||||
//// return x;
|
||||
////}
|
||||
////
|
||||
////f({ /**/ });
|
||||
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
exact: []
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// 32675 - if this fails there are two copies of assert in completions
|
||||
|
||||
// @esModuleInterop: true,
|
||||
// @target: esnext
|
||||
|
||||
// @Filename: /myAssert.d.ts
|
||||
////declare function assert(value:any, message?:string):void;
|
||||
////export = assert;
|
||||
////export as namespace assert;
|
||||
|
||||
// @Filename: /ambient.d.ts
|
||||
////import assert from './myAssert';
|
||||
////
|
||||
////type Assert = typeof assert;
|
||||
////
|
||||
////declare global {
|
||||
//// const assert: Assert;
|
||||
////}
|
||||
|
||||
// @Filename: /index.ts
|
||||
/////// <reference path="./ambient.d.ts" />
|
||||
////asser/**/;
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
includes: [
|
||||
{
|
||||
name: "assert",
|
||||
sortText: completion.SortText.GlobalsOrKeywords
|
||||
}
|
||||
],
|
||||
preferences: { includeCompletionsForModuleExports: true, includeInsertTextCompletions: true }
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @strict: true
|
||||
|
||||
//// declare function get<T, K extends keyof T>(obj: T, key: K): T[K];
|
||||
//// get({ hello: 123, world: 456 }, "/**/");
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
includes: ['hello', 'world']
|
||||
});
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @strict: true
|
||||
|
||||
//// interface MyOptions {
|
||||
//// hello?: boolean;
|
||||
//// world?: boolean;
|
||||
//// }
|
||||
//// declare function bar<T extends MyOptions>(options?: Partial<T>): void;
|
||||
//// bar({ hello, /*1*/ });
|
||||
|
||||
verify.completions({
|
||||
marker: '1',
|
||||
includes: [
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'world'
|
||||
},
|
||||
]
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @strict: true
|
||||
|
||||
//// interface Options {
|
||||
//// someFunction?: () => string
|
||||
//// anotherFunction?: () => string
|
||||
//// }
|
||||
////
|
||||
//// export class Clazz<T extends Options> {
|
||||
//// constructor(public a: T) {}
|
||||
//// }
|
||||
////
|
||||
//// new Clazz({ /*1*/ })
|
||||
|
||||
verify.completions({
|
||||
marker: '1',
|
||||
includes: [
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'someFunction'
|
||||
},
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'anotherFunction'
|
||||
},
|
||||
]
|
||||
})
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @strict: true
|
||||
|
||||
//// interface DeepOptions {
|
||||
//// another?: boolean;
|
||||
//// }
|
||||
//// interface MyOptions {
|
||||
//// hello?: boolean;
|
||||
//// world?: boolean;
|
||||
//// deep?: DeepOptions
|
||||
//// }
|
||||
//// declare function bar<T extends MyOptions>(options?: Partial<T>): void;
|
||||
//// bar({ deep: {/*1*/} });
|
||||
|
||||
verify.completions({
|
||||
marker: '1',
|
||||
includes: [
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'another'
|
||||
},
|
||||
]
|
||||
})
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @strict: true
|
||||
|
||||
//// interface Foo {
|
||||
//// a_a: boolean;
|
||||
//// a_b: boolean;
|
||||
//// a_c: boolean;
|
||||
//// b_a: boolean;
|
||||
//// }
|
||||
//// function partialFoo<T extends Partial<Foo>>(t: T) {return t}
|
||||
//// partialFoo({ /*1*/ });
|
||||
|
||||
verify.completions({
|
||||
marker: '1',
|
||||
includes: [
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'a_a'
|
||||
},
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'a_b'
|
||||
},
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'a_c'
|
||||
},
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'b_a'
|
||||
},
|
||||
]
|
||||
})
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @strict: true
|
||||
|
||||
//// interface Foo {
|
||||
//// a: boolean;
|
||||
//// }
|
||||
//// function partialFoo<T extends Partial<Foo>>(x: T, y: T) {return t}
|
||||
//// partialFoo({ a: true, b: true }, { /*1*/ });
|
||||
|
||||
verify.completions({
|
||||
marker: '1',
|
||||
includes: [
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'a'
|
||||
},
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'b'
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -0,0 +1,29 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @strict: true
|
||||
|
||||
////interface Foo {
|
||||
//// a: boolean;
|
||||
////}
|
||||
////function partialFoo<T extends Partial<Foo>>(x: T, y: T extends { b?: boolean } ? T & { c: true } : T) {
|
||||
//// return x;
|
||||
////}
|
||||
////
|
||||
////partialFoo({ a: true, b: true }, { /*1*/ });
|
||||
|
||||
|
||||
verify.completions({
|
||||
marker: '1',
|
||||
includes: [
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'a'
|
||||
},
|
||||
{
|
||||
sortText: completion.SortText.OptionalMember,
|
||||
name: 'b'
|
||||
},
|
||||
{
|
||||
name: 'c'
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
// #32708
|
||||
|
||||
////interface I<T> {
|
||||
//// /** only once please */
|
||||
//// t: T
|
||||
////}
|
||||
////interface C<T> extends I<T> {
|
||||
//// t: T
|
||||
////}
|
||||
////declare var cnsb: C<number> & C<string> & C<boolean>;
|
||||
////cnsb.t/**/
|
||||
|
||||
verify.quickInfoAt("", "(property) C<T>.t: never", "only once please");
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// https://github.com/microsoft/TypeScript/issues/32983
|
||||
|
||||
////type M = { [K in 'one']: any };
|
||||
////const x: M = {
|
||||
//// /**/one() {}
|
||||
////}
|
||||
|
||||
verify.quickInfoAt("", "(property) one: any");
|
||||
Reference in New Issue
Block a user