mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' of https://github.com/Microsoft/TypeScript into bug/36989
This commit is contained in:
+44
-41
@@ -952,6 +952,10 @@ namespace ts {
|
||||
return initFlowNode({ flags: FlowFlags.LoopLabel, antecedents: undefined });
|
||||
}
|
||||
|
||||
function createReduceLabel(target: FlowLabel, antecedents: FlowNode[], antecedent: FlowNode): FlowReduceLabel {
|
||||
return initFlowNode({ flags: FlowFlags.ReduceLabel, target, antecedents, antecedent });
|
||||
}
|
||||
|
||||
function setFlowNodeReferenced(flow: FlowNode) {
|
||||
// On first reference we set the Referenced flag, thereafter we set the Shared flag
|
||||
flow.flags |= flow.flags & FlowFlags.Referenced ? FlowFlags.Shared : FlowFlags.Referenced;
|
||||
@@ -1209,35 +1213,36 @@ namespace ts {
|
||||
}
|
||||
|
||||
function bindTryStatement(node: TryStatement): void {
|
||||
const preFinallyLabel = createBranchLabel();
|
||||
// We conservatively assume that *any* code in the try block can cause an exception, but we only need
|
||||
// to track code that causes mutations (because only mutations widen the possible control flow type of
|
||||
// a variable). The currentExceptionTarget is the target label for control flows that result from
|
||||
// exceptions. We add all mutation flow nodes as antecedents of this label such that we can analyze them
|
||||
// as possible antecedents of the start of catch or finally blocks. Furthermore, we add the current
|
||||
// control flow to represent exceptions that occur before any mutations.
|
||||
// a variable). The exceptionLabel is the target label for control flows that result from exceptions.
|
||||
// We add all mutation flow nodes as antecedents of this label such that we can analyze them as possible
|
||||
// antecedents of the start of catch or finally blocks. Furthermore, we add the current control flow to
|
||||
// represent exceptions that occur before any mutations.
|
||||
const saveReturnTarget = currentReturnTarget;
|
||||
const saveExceptionTarget = currentExceptionTarget;
|
||||
currentReturnTarget = createBranchLabel();
|
||||
currentExceptionTarget = node.catchClause ? createBranchLabel() : currentReturnTarget;
|
||||
addAntecedent(currentExceptionTarget, currentFlow);
|
||||
const normalExitLabel = createBranchLabel();
|
||||
const returnLabel = createBranchLabel();
|
||||
let exceptionLabel = createBranchLabel();
|
||||
if (node.finallyBlock) {
|
||||
currentReturnTarget = returnLabel;
|
||||
}
|
||||
addAntecedent(exceptionLabel, currentFlow);
|
||||
currentExceptionTarget = exceptionLabel;
|
||||
bind(node.tryBlock);
|
||||
addAntecedent(preFinallyLabel, currentFlow);
|
||||
const flowAfterTry = currentFlow;
|
||||
let flowAfterCatch = unreachableFlow;
|
||||
addAntecedent(normalExitLabel, currentFlow);
|
||||
if (node.catchClause) {
|
||||
// Start of catch clause is the target of exceptions from try block.
|
||||
currentFlow = finishFlowLabel(currentExceptionTarget);
|
||||
currentFlow = finishFlowLabel(exceptionLabel);
|
||||
// The currentExceptionTarget now represents control flows from exceptions in the catch clause.
|
||||
// Effectively, in a try-catch-finally, if an exception occurs in the try block, the catch block
|
||||
// acts like a second try block.
|
||||
currentExceptionTarget = currentReturnTarget;
|
||||
addAntecedent(currentExceptionTarget, currentFlow);
|
||||
exceptionLabel = createBranchLabel();
|
||||
addAntecedent(exceptionLabel, currentFlow);
|
||||
currentExceptionTarget = exceptionLabel;
|
||||
bind(node.catchClause);
|
||||
addAntecedent(preFinallyLabel, currentFlow);
|
||||
flowAfterCatch = currentFlow;
|
||||
addAntecedent(normalExitLabel, currentFlow);
|
||||
}
|
||||
const exceptionTarget = finishFlowLabel(currentExceptionTarget);
|
||||
currentReturnTarget = saveReturnTarget;
|
||||
currentExceptionTarget = saveExceptionTarget;
|
||||
if (node.finallyBlock) {
|
||||
@@ -1250,35 +1255,33 @@ namespace ts {
|
||||
// When analyzing a control flow graph that starts inside a finally block we want to consider all
|
||||
// five possibilities above. However, when analyzing a control flow graph that starts outside (past)
|
||||
// the finally block, we only want to consider the first two (if we're past a finally block then it
|
||||
// must have completed normally). To make this possible, we inject two extra nodes into the control
|
||||
// flow graph: An after-finally with an antecedent of the control flow at the end of the finally
|
||||
// block, and a pre-finally with an antecedent that represents all exceptional control flows. The
|
||||
// 'lock' property of the pre-finally references the after-finally, and the after-finally has a
|
||||
// boolean 'locked' property that we set to true when analyzing a control flow that contained the
|
||||
// the after-finally node. When the lock associated with a pre-finally is locked, the antecedent of
|
||||
// the pre-finally (i.e. the exceptional control flows) are skipped.
|
||||
const preFinallyFlow: PreFinallyFlow = initFlowNode({ flags: FlowFlags.PreFinally, antecedent: exceptionTarget, lock: {} });
|
||||
addAntecedent(preFinallyLabel, preFinallyFlow);
|
||||
currentFlow = finishFlowLabel(preFinallyLabel);
|
||||
// must have completed normally). Likewise, when analyzing a control flow graph from return statements
|
||||
// in try or catch blocks in an IIFE, we only want to consider the third. To make this possible, we
|
||||
// inject a ReduceLabel node into the control flow graph. This node contains an alternate reduced
|
||||
// set of antecedents for the pre-finally label. As control flow analysis passes by a ReduceLabel
|
||||
// node, the pre-finally label is temporarily switched to the reduced antecedent set.
|
||||
const finallyLabel = createBranchLabel();
|
||||
finallyLabel.antecedents = concatenate(concatenate(normalExitLabel.antecedents, exceptionLabel.antecedents), returnLabel.antecedents);
|
||||
currentFlow = finallyLabel;
|
||||
bind(node.finallyBlock);
|
||||
// If the end of the finally block is reachable, but the end of the try and catch blocks are not,
|
||||
// convert the current flow to unreachable. For example, 'try { return 1; } finally { ... }' should
|
||||
// result in an unreachable current control flow.
|
||||
if (!(currentFlow.flags & FlowFlags.Unreachable)) {
|
||||
if ((flowAfterTry.flags & FlowFlags.Unreachable) && (flowAfterCatch.flags & FlowFlags.Unreachable)) {
|
||||
currentFlow = flowAfterTry === reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow
|
||||
? reportedUnreachableFlow
|
||||
: unreachableFlow;
|
||||
}
|
||||
if (currentFlow.flags & FlowFlags.Unreachable) {
|
||||
// If the end of the finally block is unreachable, the end of the entire try statement is unreachable.
|
||||
currentFlow = unreachableFlow;
|
||||
}
|
||||
if (!(currentFlow.flags & FlowFlags.Unreachable)) {
|
||||
const afterFinallyFlow: AfterFinallyFlow = initFlowNode({ flags: FlowFlags.AfterFinally, antecedent: currentFlow });
|
||||
preFinallyFlow.lock = afterFinallyFlow;
|
||||
currentFlow = afterFinallyFlow;
|
||||
else {
|
||||
// If we have an IIFE return target and return statements in the try or catch blocks, add a control
|
||||
// flow that goes back through the finally block and back through only the return statements.
|
||||
if (currentReturnTarget && returnLabel.antecedents) {
|
||||
addAntecedent(currentReturnTarget, createReduceLabel(finallyLabel, returnLabel.antecedents, currentFlow));
|
||||
}
|
||||
// If the end of the finally block is reachable, but the end of the try and catch blocks are not,
|
||||
// convert the current flow to unreachable. For example, 'try { return 1; } finally { ... }' should
|
||||
// result in an unreachable current control flow.
|
||||
currentFlow = normalExitLabel.antecedents ? createReduceLabel(finallyLabel, normalExitLabel.antecedents, currentFlow) : unreachableFlow;
|
||||
}
|
||||
}
|
||||
else {
|
||||
currentFlow = finishFlowLabel(preFinallyLabel);
|
||||
currentFlow = finishFlowLabel(normalExitLabel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+125
-44
@@ -940,6 +940,7 @@ namespace ts {
|
||||
if (jsxPragma) {
|
||||
const chosenpragma = isArray(jsxPragma) ? jsxPragma[0] : jsxPragma;
|
||||
file.localJsxFactory = parseIsolatedEntityName(chosenpragma.arguments.factory, languageVersion);
|
||||
visitNode(file.localJsxFactory, markAsSynthetic);
|
||||
if (file.localJsxFactory) {
|
||||
return file.localJsxNamespace = getFirstIdentifier(file.localJsxFactory).escapedText;
|
||||
}
|
||||
@@ -950,6 +951,7 @@ namespace ts {
|
||||
_jsxNamespace = "React" as __String;
|
||||
if (compilerOptions.jsxFactory) {
|
||||
_jsxFactoryEntity = parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion);
|
||||
visitNode(_jsxFactoryEntity, markAsSynthetic);
|
||||
if (_jsxFactoryEntity) {
|
||||
_jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).escapedText;
|
||||
}
|
||||
@@ -958,7 +960,16 @@ namespace ts {
|
||||
_jsxNamespace = escapeLeadingUnderscores(compilerOptions.reactNamespace);
|
||||
}
|
||||
}
|
||||
if (!_jsxFactoryEntity) {
|
||||
_jsxFactoryEntity = createQualifiedName(createIdentifier(unescapeLeadingUnderscores(_jsxNamespace)), "createElement");
|
||||
}
|
||||
return _jsxNamespace;
|
||||
|
||||
function markAsSynthetic(node: Node): VisitResult<Node> {
|
||||
node.pos = -1;
|
||||
node.end = -1;
|
||||
return visitEachChild(node, markAsSynthetic, nullTransformationContext);
|
||||
}
|
||||
}
|
||||
|
||||
function getEmitResolver(sourceFile: SourceFile, cancellationToken: CancellationToken) {
|
||||
@@ -2802,8 +2813,8 @@ namespace ts {
|
||||
const namespaceMeaning = SymbolFlags.Namespace | (isInJSFile(name) ? meaning & SymbolFlags.Value : 0);
|
||||
let symbol: Symbol | undefined;
|
||||
if (name.kind === SyntaxKind.Identifier) {
|
||||
const message = meaning === namespaceMeaning ? Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
|
||||
const symbolFromJSPrototype = isInJSFile(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
|
||||
const message = meaning === namespaceMeaning || nodeIsSynthesized(name) ? Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
|
||||
const symbolFromJSPrototype = isInJSFile(name) && !nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
|
||||
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true);
|
||||
if (!symbol) {
|
||||
return symbolFromJSPrototype;
|
||||
@@ -2846,7 +2857,7 @@ namespace ts {
|
||||
throw Debug.assertNever(name, "Unknown entity name kind.");
|
||||
}
|
||||
Debug.assert((getCheckFlags(symbol) & CheckFlags.Instantiated) === 0, "Should never get an instantiated symbol here.");
|
||||
if (isEntityName(name) && (symbol.flags & SymbolFlags.Alias || name.parent.kind === SyntaxKind.ExportAssignment)) {
|
||||
if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & SymbolFlags.Alias || name.parent.kind === SyntaxKind.ExportAssignment)) {
|
||||
markSymbolOfAliasDeclarationIfTypeOnly(getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true);
|
||||
}
|
||||
return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol);
|
||||
@@ -14815,11 +14826,16 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getNormalizedType(type: Type, writing: boolean): Type {
|
||||
return isFreshLiteralType(type) ? (<FreshableType>type).regularType :
|
||||
getObjectFlags(type) & ObjectFlags.Reference && (<TypeReference>type).node ? createTypeReference((<TypeReference>type).target, getTypeArguments(<TypeReference>type)) :
|
||||
type.flags & TypeFlags.Substitution ? writing ? (<SubstitutionType>type).typeVariable : (<SubstitutionType>type).substitute :
|
||||
type.flags & TypeFlags.Simplifiable ? getSimplifiedType(type, writing) :
|
||||
type;
|
||||
do {
|
||||
const t = isFreshLiteralType(type) ? (<FreshableType>type).regularType :
|
||||
getObjectFlags(type) & ObjectFlags.Reference && (<TypeReference>type).node ? createTypeReference((<TypeReference>type).target, getTypeArguments(<TypeReference>type)) :
|
||||
type.flags & TypeFlags.Substitution ? writing ? (<SubstitutionType>type).typeVariable : (<SubstitutionType>type).substitute :
|
||||
type.flags & TypeFlags.Simplifiable ? getSimplifiedType(type, writing) :
|
||||
type;
|
||||
if (t === type) break;
|
||||
type = t;
|
||||
} while (true);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15344,7 +15360,7 @@ namespace ts {
|
||||
checkTypes = reducedTarget.flags & TypeFlags.Union ? (<UnionType>reducedTarget).types : [reducedTarget];
|
||||
}
|
||||
for (const prop of getPropertiesOfType(source)) {
|
||||
if (shouldCheckAsExcessProperty(prop, source.symbol)) {
|
||||
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
||||
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
||||
if (reportErrors) {
|
||||
// Report error in terms of object types in the target as those are the only ones
|
||||
@@ -16239,6 +16255,7 @@ namespace ts {
|
||||
if (unmatchedProperty.valueDeclaration
|
||||
&& isNamedDeclaration(unmatchedProperty.valueDeclaration)
|
||||
&& isPrivateIdentifier(unmatchedProperty.valueDeclaration.name)
|
||||
&& source.symbol
|
||||
&& source.symbol.flags & SymbolFlags.Class) {
|
||||
const privateIdentifierDescription = unmatchedProperty.valueDeclaration.name.escapedText;
|
||||
const symbolTableKey = getSymbolNameForPrivateIdentifier(source.symbol, privateIdentifierDescription);
|
||||
@@ -19402,16 +19419,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isReachableFlowNode(flow: FlowNode) {
|
||||
const result = isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ false);
|
||||
const result = isReachableFlowNodeWorker(flow, /*noCacheCheck*/ false);
|
||||
lastFlowNode = flow;
|
||||
lastFlowNodeReachable = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
function isUnlockedReachableFlowNode(flow: FlowNode) {
|
||||
return !(flow.flags & FlowFlags.PreFinally && (<PreFinallyFlow>flow).lock.locked) && isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ false);
|
||||
}
|
||||
|
||||
function isFalseExpression(expr: Expression): boolean {
|
||||
const node = skipParentheses(expr);
|
||||
return node.kind === SyntaxKind.FalseKeyword || node.kind === SyntaxKind.BinaryExpression && (
|
||||
@@ -19429,11 +19442,11 @@ namespace ts {
|
||||
if (!noCacheCheck) {
|
||||
const id = getFlowNodeId(flow);
|
||||
const reachable = flowNodeReachable[id];
|
||||
return reachable !== undefined ? reachable : (flowNodeReachable[id] = isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ true));
|
||||
return reachable !== undefined ? reachable : (flowNodeReachable[id] = isReachableFlowNodeWorker(flow, /*noCacheCheck*/ true));
|
||||
}
|
||||
noCacheCheck = false;
|
||||
}
|
||||
if (flags & (FlowFlags.Assignment | FlowFlags.Condition | FlowFlags.ArrayMutation | FlowFlags.PreFinally)) {
|
||||
if (flags & (FlowFlags.Assignment | FlowFlags.Condition | FlowFlags.ArrayMutation)) {
|
||||
flow = (<FlowAssignment | FlowCondition | FlowArrayMutation | PreFinallyFlow>flow).antecedent;
|
||||
}
|
||||
else if (flags & FlowFlags.Call) {
|
||||
@@ -19454,7 +19467,7 @@ namespace ts {
|
||||
}
|
||||
else if (flags & FlowFlags.BranchLabel) {
|
||||
// A branching point is reachable if any branch is reachable.
|
||||
return some((<FlowLabel>flow).antecedents, isUnlockedReachableFlowNode);
|
||||
return some((<FlowLabel>flow).antecedents, f => isReachableFlowNodeWorker(f, /*noCacheCheck*/ false));
|
||||
}
|
||||
else if (flags & FlowFlags.LoopLabel) {
|
||||
// A loop is reachable if the control flow path that leads to the top is reachable.
|
||||
@@ -19468,12 +19481,14 @@ namespace ts {
|
||||
}
|
||||
flow = (<FlowSwitchClause>flow).antecedent;
|
||||
}
|
||||
else if (flags & FlowFlags.AfterFinally) {
|
||||
// Cache is unreliable once we start locking nodes
|
||||
else if (flags & FlowFlags.ReduceLabel) {
|
||||
// Cache is unreliable once we start adjusting labels
|
||||
lastFlowNode = undefined;
|
||||
(<AfterFinallyFlow>flow).locked = true;
|
||||
const result = isReachableFlowNodeWorker((<AfterFinallyFlow>flow).antecedent, /*skipCacheCheck*/ false);
|
||||
(<AfterFinallyFlow>flow).locked = false;
|
||||
const target = (<FlowReduceLabel>flow).target;
|
||||
const saveAntecedents = target.antecedents;
|
||||
target.antecedents = (<FlowReduceLabel>flow).antecedents;
|
||||
const result = isReachableFlowNodeWorker((<FlowReduceLabel>flow).antecedent, /*noCacheCheck*/ false);
|
||||
target.antecedents = saveAntecedents;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
@@ -19537,19 +19552,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
let type: FlowType | undefined;
|
||||
if (flags & FlowFlags.AfterFinally) {
|
||||
// block flow edge: finally -> pre-try (for larger explanation check comment in binder.ts - bindTryStatement
|
||||
(<AfterFinallyFlow>flow).locked = true;
|
||||
type = getTypeAtFlowNode((<AfterFinallyFlow>flow).antecedent);
|
||||
(<AfterFinallyFlow>flow).locked = false;
|
||||
}
|
||||
else if (flags & FlowFlags.PreFinally) {
|
||||
// locked pre-finally flows are filtered out in getTypeAtFlowBranchLabel
|
||||
// so here just redirect to antecedent
|
||||
flow = (<PreFinallyFlow>flow).antecedent;
|
||||
continue;
|
||||
}
|
||||
else if (flags & FlowFlags.Assignment) {
|
||||
if (flags & FlowFlags.Assignment) {
|
||||
type = getTypeAtFlowAssignment(<FlowAssignment>flow);
|
||||
if (!type) {
|
||||
flow = (<FlowAssignment>flow).antecedent;
|
||||
@@ -19585,6 +19588,13 @@ namespace ts {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (flags & FlowFlags.ReduceLabel) {
|
||||
const target = (<FlowReduceLabel>flow).target;
|
||||
const saveAntecedents = target.antecedents;
|
||||
target.antecedents = (<FlowReduceLabel>flow).antecedents;
|
||||
type = getTypeAtFlowNode((<FlowReduceLabel>flow).antecedent);
|
||||
target.antecedents = saveAntecedents;
|
||||
}
|
||||
else if (flags & FlowFlags.Start) {
|
||||
// Check if we should continue with the control flow of the containing function.
|
||||
const container = (<FlowStart>flow).node;
|
||||
@@ -19796,12 +19806,6 @@ namespace ts {
|
||||
let seenIncomplete = false;
|
||||
let bypassFlow: FlowSwitchClause | undefined;
|
||||
for (const antecedent of flow.antecedents!) {
|
||||
if (antecedent.flags & FlowFlags.PreFinally && (<PreFinallyFlow>antecedent).lock.locked) {
|
||||
// if flow correspond to branch from pre-try to finally and this branch is locked - this means that
|
||||
// we initially have started following the flow outside the finally block.
|
||||
// in this case we should ignore this branch.
|
||||
continue;
|
||||
}
|
||||
if (!bypassFlow && antecedent.flags & FlowFlags.SwitchClause && (<FlowSwitchClause>antecedent).clauseStart === (<FlowSwitchClause>antecedent).clauseEnd) {
|
||||
// The antecedent is the bypass branch of a potentially exhaustive switch statement.
|
||||
bypassFlow = <FlowSwitchClause>antecedent;
|
||||
@@ -24391,7 +24395,7 @@ namespace ts {
|
||||
// can be specified by users through attributes property.
|
||||
const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
|
||||
const attributesType = checkExpressionWithContextualType(node.attributes, paramType, /*inferenceContext*/ undefined, checkMode);
|
||||
return checkTypeRelatedToAndOptionallyElaborate(
|
||||
return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(
|
||||
attributesType,
|
||||
paramType,
|
||||
relation,
|
||||
@@ -24400,6 +24404,80 @@ namespace ts {
|
||||
/*headMessage*/ undefined,
|
||||
containingMessageChain,
|
||||
errorOutputContainer);
|
||||
|
||||
function checkTagNameDoesNotExpectTooManyArguments(): boolean {
|
||||
const tagType = isJsxOpeningElement(node) || isJsxSelfClosingElement(node) && !isJsxIntrinsicIdentifier(node.tagName) ? checkExpression(node.tagName) : undefined;
|
||||
if (!tagType) {
|
||||
return true;
|
||||
}
|
||||
const tagCallSignatures = getSignaturesOfType(tagType, SignatureKind.Call);
|
||||
if (!length(tagCallSignatures)) {
|
||||
return true;
|
||||
}
|
||||
const factory = getJsxFactoryEntity(node);
|
||||
if (!factory) {
|
||||
return true;
|
||||
}
|
||||
const factorySymbol = resolveEntityName(factory, SymbolFlags.Value, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, node);
|
||||
if (!factorySymbol) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const factoryType = getTypeOfSymbol(factorySymbol);
|
||||
const callSignatures = getSignaturesOfType(factoryType, SignatureKind.Call);
|
||||
if (!length(callSignatures)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let hasFirstParamSignatures = false;
|
||||
let maxParamCount = 0;
|
||||
// Check that _some_ first parameter expects a FC-like thing, and that some overload of the SFC expects an acceptable number of arguments
|
||||
for (const sig of callSignatures) {
|
||||
const firstparam = getTypeAtPosition(sig, 0);
|
||||
const signaturesOfParam = getSignaturesOfType(firstparam, SignatureKind.Call);
|
||||
if (!length(signaturesOfParam)) continue;
|
||||
for (const paramSig of signaturesOfParam) {
|
||||
hasFirstParamSignatures = true;
|
||||
if (hasEffectiveRestParameter(paramSig)) {
|
||||
return true; // some signature has a rest param, so function components can have an arbitrary number of arguments
|
||||
}
|
||||
const paramCount = getParameterCount(paramSig);
|
||||
if (paramCount > maxParamCount) {
|
||||
maxParamCount = paramCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasFirstParamSignatures) {
|
||||
// Not a single signature had a first parameter which expected a signature - for back compat, and
|
||||
// to guard against generic factories which won't have signatures directly, do not error
|
||||
return true;
|
||||
}
|
||||
let absoluteMinArgCount = Infinity;
|
||||
for (const tagSig of tagCallSignatures) {
|
||||
const tagRequiredArgCount = getMinArgumentCount(tagSig);
|
||||
if (tagRequiredArgCount < absoluteMinArgCount) {
|
||||
absoluteMinArgCount = tagRequiredArgCount;
|
||||
}
|
||||
}
|
||||
if (absoluteMinArgCount <= maxParamCount) {
|
||||
return true; // some signature accepts the number of arguments the function component provides
|
||||
}
|
||||
|
||||
if (reportErrors) {
|
||||
const diag = createDiagnosticForNode(node.tagName, Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3, entityNameToString(node.tagName), absoluteMinArgCount, entityNameToString(factory), maxParamCount);
|
||||
const tagNameDeclaration = getSymbolAtLocation(node.tagName)?.valueDeclaration;
|
||||
if (tagNameDeclaration) {
|
||||
addRelatedInfo(diag, createDiagnosticForNode(tagNameDeclaration, Diagnostics._0_is_declared_here, entityNameToString(node.tagName)));
|
||||
}
|
||||
if (errorOutputContainer && errorOutputContainer.skipLogging) {
|
||||
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
|
||||
}
|
||||
if (!errorOutputContainer.skipLogging) {
|
||||
diagnostics.add(diag);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getSignatureApplicabilityError(
|
||||
@@ -35282,6 +35360,10 @@ namespace ts {
|
||||
return literalTypeToNode(<FreshableType>type, node, tracker);
|
||||
}
|
||||
|
||||
function getJsxFactoryEntity(location: Node) {
|
||||
return location ? (getJsxNamespace(location), (getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity;
|
||||
}
|
||||
|
||||
function createResolver(): EmitResolver {
|
||||
// this variable and functions that use it are deliberately moved here from the outer scope
|
||||
// to avoid scope pollution
|
||||
@@ -35353,7 +35435,7 @@ namespace ts {
|
||||
const symbol = node && getSymbolOfNode(node);
|
||||
return !!(symbol && getCheckFlags(symbol) & CheckFlags.Late);
|
||||
},
|
||||
getJsxFactoryEntity: location => location ? (getJsxNamespace(location), (getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity,
|
||||
getJsxFactoryEntity,
|
||||
getAllAccessorDeclarations(accessor: AccessorDeclaration): AllAccessorDeclarations {
|
||||
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration)!; // TODO: GH#18217
|
||||
const otherKind = accessor.kind === SyntaxKind.SetAccessor ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor;
|
||||
@@ -35668,7 +35750,6 @@ namespace ts {
|
||||
case ExternalEmitHelpers.ClassPrivateFieldGet: return "__classPrivateFieldGet";
|
||||
case ExternalEmitHelpers.ClassPrivateFieldSet: return "__classPrivateFieldSet";
|
||||
case ExternalEmitHelpers.CreateBinding: return "__createBinding";
|
||||
case ExternalEmitHelpers.SetModuleDefault: return "__setModuleDefault";
|
||||
default: return Debug.fail("Unrecognized helper");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4292,6 +4292,10 @@
|
||||
"category": "Message",
|
||||
"code": 6228
|
||||
},
|
||||
"Tag '{0}' expects at least '{1}' arguments, but the JSX factory '{2}' provides at most '{3}'.": {
|
||||
"category": "Error",
|
||||
"code": 6229
|
||||
},
|
||||
|
||||
"Projects to reference": {
|
||||
"category": "Message",
|
||||
|
||||
@@ -278,6 +278,7 @@ namespace ts {
|
||||
name: "typescript:spread",
|
||||
importName: "__spread",
|
||||
scoped: false,
|
||||
dependencies: [readHelper],
|
||||
text: `
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
@@ -286,7 +287,6 @@ namespace ts {
|
||||
};
|
||||
|
||||
export function createSpreadHelper(context: TransformationContext, argumentList: readonly Expression[], location?: TextRange) {
|
||||
context.requestEmitHelper(readHelper);
|
||||
context.requestEmitHelper(spreadHelper);
|
||||
return setTextRange(
|
||||
createCall(
|
||||
|
||||
@@ -2943,6 +2943,8 @@ namespace ts {
|
||||
importDefaultHelper,
|
||||
classPrivateFieldGetHelper,
|
||||
classPrivateFieldSetHelper,
|
||||
createBindingHelper,
|
||||
setModuleDefaultHelper
|
||||
], helper => helper.name));
|
||||
}
|
||||
|
||||
|
||||
+77
-24
@@ -522,6 +522,76 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/**
|
||||
* Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes
|
||||
* stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; additionally,
|
||||
* unlike `forEachChild`, embedded arrays are flattened and the 'cbNode' callback is invoked for each element.
|
||||
* If a callback returns a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned.
|
||||
*
|
||||
* @param node a given node to visit its children
|
||||
* @param cbNode a callback to be invoked for all child nodes
|
||||
* @param cbNodes a callback to be invoked for embedded array
|
||||
*
|
||||
* @remarks Unlike `forEachChild`, `forEachChildRecursively` handles recursively invoking the traversal on each child node found,
|
||||
* and while doing so, handles traversing the structure without relying on the callstack to encode the tree structure.
|
||||
*/
|
||||
export function forEachChildRecursively<T>(rootNode: Node, cbNode: (node: Node, parent: Node) => T | "skip" | undefined, cbNodes?: (nodes: NodeArray<Node>, parent: Node) => T | "skip" | undefined): T | undefined {
|
||||
|
||||
const stack: Node[] = [rootNode];
|
||||
while (stack.length) {
|
||||
const parent = stack.pop()!;
|
||||
const res = visitAllPossibleChildren(parent, gatherPossibleChildren(parent));
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
function gatherPossibleChildren(node: Node) {
|
||||
const children: (Node | NodeArray<Node>)[] = [];
|
||||
forEachChild(node, addWorkItem, addWorkItem); // By using a stack above and `unshift` here, we emulate a depth-first preorder traversal
|
||||
return children;
|
||||
|
||||
function addWorkItem(n: Node | NodeArray<Node>) {
|
||||
children.unshift(n);
|
||||
}
|
||||
}
|
||||
|
||||
function visitAllPossibleChildren(parent: Node, children: readonly (Node | NodeArray<Node>)[]) {
|
||||
for (const child of children) {
|
||||
if (isArray(child)) {
|
||||
if (cbNodes) {
|
||||
const res = cbNodes(child, parent);
|
||||
if (res) {
|
||||
if (res === "skip") continue;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = child.length - 1; i >= 0; i--) {
|
||||
const realChild = child[i];
|
||||
const res = cbNode(realChild, parent);
|
||||
if (res) {
|
||||
if (res === "skip") continue;
|
||||
return res;
|
||||
}
|
||||
stack.push(realChild);
|
||||
}
|
||||
}
|
||||
else {
|
||||
stack.push(child);
|
||||
const res = cbNode(child, parent);
|
||||
if (res) {
|
||||
if (res === "skip") continue;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false, scriptKind?: ScriptKind): SourceFile {
|
||||
performance.mark("beforeParse");
|
||||
let result: SourceFile;
|
||||
@@ -903,31 +973,14 @@ namespace ts {
|
||||
// a syntax tree, and no semantic features, then the binding process is an unnecessary
|
||||
// overhead. This functions allows us to set all the parents, without all the expense of
|
||||
// binding.
|
||||
forEachChildRecursively(rootNode, bindParentToChild);
|
||||
|
||||
const stack: Node[] = [rootNode];
|
||||
while (stack.length) {
|
||||
const parent = stack.pop()!;
|
||||
bindParentToChildren(parent, gatherChildren(parent));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
function gatherChildren(node: Node) {
|
||||
const children: Node[] = [];
|
||||
forEachChild(node, n => { children.unshift(n); }); // By using a stack above and `unshift` here, we emulate a depth-first preorder traversal
|
||||
return children;
|
||||
}
|
||||
|
||||
function bindParentToChildren(parent: Node, children: readonly Node[]) {
|
||||
for (const child of children) {
|
||||
if (child.parent === parent) continue; // already bound, assume subtree is bound
|
||||
child.parent = parent;
|
||||
stack.push(child);
|
||||
if (hasJSDocNodes(child)) {
|
||||
for (const jsDoc of child.jsDoc!) {
|
||||
jsDoc.parent = child;
|
||||
stack.push(jsDoc);
|
||||
}
|
||||
function bindParentToChild(child: Node, parent: Node) {
|
||||
child.parent = parent;
|
||||
if (hasJSDocNodes(child)) {
|
||||
for (const doc of child.jsDoc!) {
|
||||
bindParentToChild(doc, child);
|
||||
forEachChildRecursively(doc, bindParentToChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
-33
@@ -553,7 +553,7 @@ namespace ts {
|
||||
program: Program | undefined,
|
||||
rootFileNames: string[],
|
||||
newOptions: CompilerOptions,
|
||||
getSourceVersion: (path: Path) => string | undefined,
|
||||
getSourceVersion: (path: Path, fileName: string) => string | undefined,
|
||||
fileExists: (fileName: string) => boolean,
|
||||
hasInvalidatedResolution: HasInvalidatedResolution,
|
||||
hasChangedAutomaticTypeDirectiveNames: boolean,
|
||||
@@ -606,7 +606,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function sourceFileVersionUptoDate(sourceFile: SourceFile) {
|
||||
return sourceFile.version === getSourceVersion(sourceFile.resolvedPath);
|
||||
return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName);
|
||||
}
|
||||
|
||||
function projectReferenceUptoDate(oldRef: ProjectReference, newRef: ProjectReference, index: number) {
|
||||
@@ -1779,12 +1779,12 @@ namespace ts {
|
||||
function getJSSyntacticDiagnosticsForFile(sourceFile: SourceFile): DiagnosticWithLocation[] {
|
||||
return runWithCancellationToken(() => {
|
||||
const diagnostics: DiagnosticWithLocation[] = [];
|
||||
let parent: Node = sourceFile;
|
||||
walk(sourceFile);
|
||||
walk(sourceFile, sourceFile);
|
||||
forEachChildRecursively(sourceFile, walk, walkArray);
|
||||
|
||||
return diagnostics;
|
||||
|
||||
function walk(node: Node) {
|
||||
function walk(node: Node, parent: Node) {
|
||||
// Return directly from the case if the given node doesnt want to visit each child
|
||||
// Otherwise break to visit each child
|
||||
|
||||
@@ -1794,7 +1794,7 @@ namespace ts {
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
if ((<ParameterDeclaration | PropertyDeclaration | MethodDeclaration>parent).questionToken === node) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
// falls through
|
||||
case SyntaxKind.MethodSignature:
|
||||
@@ -1808,7 +1808,7 @@ namespace ts {
|
||||
// type annotation
|
||||
if ((<FunctionLikeDeclaration | VariableDeclaration | ParameterDeclaration | PropertyDeclaration>parent).type === node) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1816,65 +1816,60 @@ namespace ts {
|
||||
case SyntaxKind.ImportClause:
|
||||
if ((node as ImportClause).isTypeOnly) {
|
||||
diagnostics.push(createDiagnosticForNode(node.parent, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type"));
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
if ((node as ExportDeclaration).isTypeOnly) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type"));
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
case SyntaxKind.ExportAssignment:
|
||||
if ((<ExportAssignment>node).isExportEquals) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.HeritageClause:
|
||||
const heritageClause = <HeritageClause>node;
|
||||
if (heritageClause.token === SyntaxKind.ImplementsKeyword) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
const interfaceKeyword = tokenToString(SyntaxKind.InterfaceKeyword);
|
||||
Debug.assertIsDefined(interfaceKeyword);
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword));
|
||||
return;
|
||||
return "skip";
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
const moduleKeyword = node.flags & NodeFlags.Namespace ? tokenToString(SyntaxKind.NamespaceKeyword) : tokenToString(SyntaxKind.ModuleKeyword);
|
||||
Debug.assertIsDefined(moduleKeyword);
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword));
|
||||
return;
|
||||
return "skip";
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
const enumKeyword = Debug.checkDefined(tokenToString(SyntaxKind.EnumKeyword));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword));
|
||||
return;
|
||||
return "skip";
|
||||
case SyntaxKind.NonNullExpression:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
case SyntaxKind.AsExpression:
|
||||
diagnostics.push(createDiagnosticForNode((node as AsExpression).type, Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX.
|
||||
}
|
||||
|
||||
const prevParent = parent;
|
||||
parent = node;
|
||||
forEachChild(node, walk, walkArray);
|
||||
parent = prevParent;
|
||||
}
|
||||
|
||||
function walkArray(nodes: NodeArray<Node>) {
|
||||
function walkArray(nodes: NodeArray<Node>, parent: Node) {
|
||||
if (parent.decorators === nodes && !options.experimentalDecorators) {
|
||||
diagnostics.push(createDiagnosticForNode(parent, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning));
|
||||
}
|
||||
@@ -1892,14 +1887,15 @@ namespace ts {
|
||||
// Check type parameters
|
||||
if (nodes === (<DeclarationWithTypeParameterChildren>parent).typeParameters) {
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
// falls through
|
||||
|
||||
case SyntaxKind.VariableStatement:
|
||||
// Check modifiers
|
||||
if (nodes === parent.modifiers) {
|
||||
return checkModifiers(parent.modifiers, parent.kind === SyntaxKind.VariableStatement);
|
||||
checkModifiers(parent.modifiers, parent.kind === SyntaxKind.VariableStatement);
|
||||
return "skip";
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
@@ -1910,14 +1906,14 @@ namespace ts {
|
||||
diagnostics.push(createDiagnosticForNode(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
|
||||
}
|
||||
}
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Parameter:
|
||||
// Check modifiers of parameter declaration
|
||||
if (nodes === (<ParameterDeclaration>parent).modifiers) {
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.CallExpression:
|
||||
@@ -1929,14 +1925,10 @@ namespace ts {
|
||||
// Check type arguments
|
||||
if (nodes === (<NodeWithTypeArguments>parent).typeArguments) {
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
return "skip";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (const node of nodes) {
|
||||
walk(node);
|
||||
}
|
||||
}
|
||||
|
||||
function checkModifiers(modifiers: NodeArray<Modifier>, isConstValid: boolean) {
|
||||
|
||||
@@ -1096,6 +1096,7 @@ namespace ts {
|
||||
name: "typescript:asyncGenerator",
|
||||
importName: "__asyncGenerator",
|
||||
scoped: false,
|
||||
dependencies: [awaitHelper],
|
||||
text: `
|
||||
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
@@ -1111,7 +1112,6 @@ namespace ts {
|
||||
};
|
||||
|
||||
function createAsyncGeneratorHelper(context: TransformationContext, generatorFunc: FunctionExpression, hasLexicalThis: boolean) {
|
||||
context.requestEmitHelper(awaitHelper);
|
||||
context.requestEmitHelper(asyncGeneratorHelper);
|
||||
|
||||
// Mark this node as originally an async function
|
||||
@@ -1132,6 +1132,7 @@ namespace ts {
|
||||
name: "typescript:asyncDelegator",
|
||||
importName: "__asyncDelegator",
|
||||
scoped: false,
|
||||
dependencies: [awaitHelper],
|
||||
text: `
|
||||
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
||||
var i, p;
|
||||
@@ -1141,7 +1142,6 @@ namespace ts {
|
||||
};
|
||||
|
||||
function createAsyncDelegatorHelper(context: TransformationContext, expression: Expression, location?: TextRange) {
|
||||
context.requestEmitHelper(awaitHelper);
|
||||
context.requestEmitHelper(asyncDelegator);
|
||||
return setTextRange(
|
||||
createCall(
|
||||
|
||||
+11
-7
@@ -2770,10 +2770,9 @@ namespace ts {
|
||||
SwitchClause = 1 << 7, // Switch statement clause
|
||||
ArrayMutation = 1 << 8, // Potential array mutation
|
||||
Call = 1 << 9, // Potential assertion call
|
||||
Referenced = 1 << 10, // Referenced as antecedent once
|
||||
Shared = 1 << 11, // Referenced as antecedent more than once
|
||||
PreFinally = 1 << 12, // Injected edge that links pre-finally label and pre-try flow
|
||||
AfterFinally = 1 << 13, // Injected edge that links post-finally flow with the rest of the graph
|
||||
ReduceLabel = 1 << 10, // Temporarily reduce antecedents of label
|
||||
Referenced = 1 << 11, // Referenced as antecedent once
|
||||
Shared = 1 << 12, // Referenced as antecedent more than once
|
||||
|
||||
Label = BranchLabel | LoopLabel,
|
||||
Condition = TrueCondition | FalseCondition,
|
||||
@@ -2853,6 +2852,12 @@ namespace ts {
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
|
||||
export interface FlowReduceLabel extends FlowNodeBase {
|
||||
target: FlowLabel;
|
||||
antecedents: FlowNode[];
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
|
||||
export type FlowType = Type | IncompleteType;
|
||||
|
||||
// Incomplete types occur during control flow analysis of loops. An IncompleteType
|
||||
@@ -5837,10 +5842,9 @@ namespace ts {
|
||||
MakeTemplateObject = 1 << 17, // __makeTemplateObject (used for constructing template string array objects)
|
||||
ClassPrivateFieldGet = 1 << 18, // __classPrivateFieldGet (used by the class private field transformation)
|
||||
ClassPrivateFieldSet = 1 << 19, // __classPrivateFieldSet (used by the class private field transformation)
|
||||
CreateBinding = 1 << 20, // __createBinding (use by the module transform for exports and namespace imports)
|
||||
SetModuleDefault = 1 << 21, // __setModuleDefault (use by the module transform for default exports)
|
||||
CreateBinding = 1 << 20, // __createBinding (use by the module transform for (re)exports and namespace imports)
|
||||
FirstEmitHelper = Extends,
|
||||
LastEmitHelper = SetModuleDefault,
|
||||
LastEmitHelper = CreateBinding,
|
||||
|
||||
// Helpers included by ES2015 for..of
|
||||
ForOfIncludes = Values,
|
||||
|
||||
@@ -864,14 +864,17 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function entityNameToString(name: EntityNameOrEntityNameExpression): string {
|
||||
export function entityNameToString(name: EntityNameOrEntityNameExpression | JsxTagNameExpression | PrivateIdentifier): string {
|
||||
switch (name.kind) {
|
||||
case SyntaxKind.ThisKeyword:
|
||||
return "this";
|
||||
case SyntaxKind.PrivateIdentifier:
|
||||
case SyntaxKind.Identifier:
|
||||
return getFullWidth(name) === 0 ? idText(name) : getTextOfNode(name);
|
||||
case SyntaxKind.QualifiedName:
|
||||
return entityNameToString(name.left) + "." + entityNameToString(name.right);
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
if (isIdentifier(name.name)) {
|
||||
if (isIdentifier(name.name) || isPrivateIdentifier(name.name)) {
|
||||
return entityNameToString(name.expression) + "." + entityNameToString(name.name);
|
||||
}
|
||||
else {
|
||||
|
||||
+16
-15
@@ -46,10 +46,9 @@ namespace Debug {
|
||||
readonly SwitchClause: number,
|
||||
readonly ArrayMutation: number,
|
||||
readonly Call: number,
|
||||
readonly ReduceLabel: number,
|
||||
readonly Referenced: number,
|
||||
readonly Shared: number,
|
||||
readonly PreFinally: number,
|
||||
readonly AfterFinally: number,
|
||||
readonly Label: number,
|
||||
readonly Condition: number,
|
||||
};
|
||||
@@ -69,6 +68,7 @@ namespace Debug {
|
||||
| FlowCondition
|
||||
| FlowSwitchClause
|
||||
| FlowArrayMutation
|
||||
| FlowReduceLabel
|
||||
;
|
||||
|
||||
interface FlowNodeBase {
|
||||
@@ -119,6 +119,12 @@ namespace Debug {
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
|
||||
export interface FlowReduceLabel extends FlowNodeBase {
|
||||
target: FlowLabel;
|
||||
antecedents: FlowNode[];
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
|
||||
type FlowFlags = number;
|
||||
let FlowFlags: TypeScriptModule["FlowFlags"];
|
||||
let getSourceFileOfNode: TypeScriptModule["getSourceFileOfNode"];
|
||||
@@ -199,8 +205,7 @@ namespace Debug {
|
||||
FlowFlags.SwitchClause |
|
||||
FlowFlags.ArrayMutation |
|
||||
FlowFlags.Call |
|
||||
FlowFlags.PreFinally |
|
||||
FlowFlags.AfterFinally;
|
||||
FlowFlags.ReduceLabel;
|
||||
|
||||
const hasNodeFlags =
|
||||
FlowFlags.Start |
|
||||
@@ -264,17 +269,14 @@ namespace Debug {
|
||||
if (!graphNode) {
|
||||
links[id] = graphNode = { id, flowNode, edges: [], text: renderFlowNode(flowNode), lane: -1, endLane: -1, level: -1 };
|
||||
nodes.push(graphNode);
|
||||
if (!(flowNode.flags & FlowFlags.PreFinally)) {
|
||||
if (hasAntecedents(flowNode)) {
|
||||
|
||||
for (const antecedent of flowNode.antecedents) {
|
||||
buildGraphEdge(graphNode, antecedent);
|
||||
}
|
||||
}
|
||||
else if (hasAntecedent(flowNode)) {
|
||||
buildGraphEdge(graphNode, flowNode.antecedent);
|
||||
if (hasAntecedents(flowNode)) {
|
||||
for (const antecedent of flowNode.antecedents) {
|
||||
buildGraphEdge(graphNode, antecedent);
|
||||
}
|
||||
}
|
||||
else if (hasAntecedent(flowNode)) {
|
||||
buildGraphEdge(graphNode, flowNode.antecedent);
|
||||
}
|
||||
}
|
||||
return graphNode;
|
||||
}
|
||||
@@ -341,8 +343,7 @@ namespace Debug {
|
||||
if (flags & FlowFlags.SwitchClause) return "SwitchClause";
|
||||
if (flags & FlowFlags.ArrayMutation) return "ArrayMutation";
|
||||
if (flags & FlowFlags.Call) return "Call";
|
||||
if (flags & FlowFlags.PreFinally) return "PreFinally";
|
||||
if (flags & FlowFlags.AfterFinally) return "AfterFinally";
|
||||
if (flags & FlowFlags.ReduceLabel) return "ReduceLabel";
|
||||
if (flags & FlowFlags.Unreachable) return "Unreachable";
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
@@ -808,6 +808,10 @@ namespace ts.server {
|
||||
return notImplemented();
|
||||
}
|
||||
|
||||
clearSourceMapperCache(): never {
|
||||
return notImplemented();
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
throw new Error("dispose is not available through the server layer.");
|
||||
}
|
||||
|
||||
@@ -2500,18 +2500,35 @@ namespace FourSlash {
|
||||
|
||||
public printOutliningSpans() {
|
||||
const spans = this.languageService.getOutliningSpans(this.activeFile.fileName);
|
||||
Harness.IO.log(`Outlining spans (${spans.length} items)`);
|
||||
Harness.IO.log(`Outlining spans (${spans.length} items)\nResults:`);
|
||||
Harness.IO.log(stringify(spans));
|
||||
this.printOutliningSpansInline(spans);
|
||||
}
|
||||
|
||||
private printOutliningSpansInline(spans: ts.OutliningSpan[]) {
|
||||
const allSpanInsets = [] as { text: string, pos: number }[];
|
||||
let annotated = this.activeFile.content;
|
||||
ts.forEach(spans, span => {
|
||||
allSpanInsets.push({ text: "[|", pos: span.textSpan.start });
|
||||
allSpanInsets.push({ text: "|]", pos: span.textSpan.start + span.textSpan.length });
|
||||
});
|
||||
|
||||
const reverseSpans = allSpanInsets.sort((l, r) => r.pos - l.pos);
|
||||
ts.forEach(reverseSpans, span => {
|
||||
annotated = annotated.slice(0, span.pos) + span.text + annotated.slice(span.pos);
|
||||
});
|
||||
Harness.IO.log(`\nMockup:\n${annotated}`);
|
||||
}
|
||||
|
||||
public verifyOutliningSpans(spans: Range[], kind?: "comment" | "region" | "code" | "imports") {
|
||||
const actual = this.languageService.getOutliningSpans(this.activeFile.fileName);
|
||||
|
||||
if (actual.length !== spans.length) {
|
||||
this.raiseError(`verifyOutliningSpans failed - expected total spans to be ${spans.length}, but was ${actual.length}`);
|
||||
const filterActual = ts.filter(actual, f => kind === undefined ? true : f.kind === kind);
|
||||
if (filterActual.length !== spans.length) {
|
||||
this.raiseError(`verifyOutliningSpans failed - expected total spans to be ${spans.length}, but was ${actual.length}\n\nFound Spans:\n\n${this.printOutliningSpansInline(actual)}`);
|
||||
}
|
||||
|
||||
ts.zipWith(spans, actual, (expectedSpan, actualSpan, i) => {
|
||||
ts.zipWith(spans, filterActual, (expectedSpan, actualSpan, i) => {
|
||||
if (expectedSpan.pos !== actualSpan.textSpan.start || expectedSpan.end !== ts.textSpanEnd(actualSpan.textSpan)) {
|
||||
return this.raiseError(`verifyOutliningSpans failed - span ${(i + 1)} expected: (${expectedSpan.pos},${expectedSpan.end}), actual: (${actualSpan.textSpan.start},${ts.textSpanEnd(actualSpan.textSpan)})`);
|
||||
}
|
||||
|
||||
@@ -598,6 +598,9 @@ namespace Harness.LanguageService {
|
||||
getSourceMapper(): never {
|
||||
return ts.notImplemented();
|
||||
}
|
||||
clearSourceMapperCache(): never {
|
||||
return ts.notImplemented();
|
||||
}
|
||||
dispose(): void { this.shim.dispose({}); }
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -873,9 +873,11 @@ namespace ts.server {
|
||||
this.delayEnsureProjectForOpenFiles();
|
||||
}
|
||||
|
||||
private delayUpdateProjectGraphs(projects: readonly Project[]) {
|
||||
private delayUpdateProjectGraphs(projects: readonly Project[], clearSourceMapperCache: boolean) {
|
||||
if (projects.length) {
|
||||
for (const project of projects) {
|
||||
// Even if program doesnt change, clear the source mapper cache
|
||||
if (clearSourceMapperCache) project.clearSourceMapperCache();
|
||||
this.delayUpdateProjectGraph(project);
|
||||
}
|
||||
this.delayEnsureProjectForOpenFiles();
|
||||
@@ -1033,7 +1035,7 @@ namespace ts.server {
|
||||
// file has been changed which might affect the set of referenced files in projects that include
|
||||
// this file and set of inferred projects
|
||||
info.delayReloadNonMixedContentFile();
|
||||
this.delayUpdateProjectGraphs(info.containingProjects);
|
||||
this.delayUpdateProjectGraphs(info.containingProjects, /*clearSourceMapperCache*/ false);
|
||||
this.handleSourceMapProjects(info);
|
||||
}
|
||||
}
|
||||
@@ -1066,7 +1068,7 @@ namespace ts.server {
|
||||
private delayUpdateProjectsOfScriptInfoPath(path: Path) {
|
||||
const info = this.getScriptInfoForPath(path);
|
||||
if (info) {
|
||||
this.delayUpdateProjectGraphs(info.containingProjects);
|
||||
this.delayUpdateProjectGraphs(info.containingProjects, /*clearSourceMapperCache*/ true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1082,7 +1084,7 @@ namespace ts.server {
|
||||
info.detachAllProjects();
|
||||
|
||||
// update projects to make sure that set of referenced files is correct
|
||||
this.delayUpdateProjectGraphs(containingProjects);
|
||||
this.delayUpdateProjectGraphs(containingProjects, /*clearSourceMapperCache*/ false);
|
||||
this.handleSourceMapProjects(info);
|
||||
info.closeSourceMapFileWatcher();
|
||||
// need to recalculate source map from declaration file
|
||||
@@ -2537,7 +2539,7 @@ namespace ts.server {
|
||||
const declarationInfo = this.getScriptInfoForPath(declarationInfoPath);
|
||||
if (declarationInfo && declarationInfo.sourceMapFilePath && !isString(declarationInfo.sourceMapFilePath)) {
|
||||
// Update declaration and source projects
|
||||
this.delayUpdateProjectGraphs(declarationInfo.containingProjects);
|
||||
this.delayUpdateProjectGraphs(declarationInfo.containingProjects, /*clearSourceMapperCache*/ true);
|
||||
this.delayUpdateSourceInfoProjects(declarationInfo.sourceMapFilePath.sourceInfos);
|
||||
declarationInfo.closeSourceMapFileWatcher();
|
||||
}
|
||||
@@ -3117,8 +3119,9 @@ namespace ts.server {
|
||||
return;
|
||||
}
|
||||
|
||||
const info: OpenFileInfo = { checkJs: !!project.getSourceFile(scriptInfo.path)!.checkJsDirective };
|
||||
this.eventHandler({ eventName: OpenFileInfoTelemetryEvent, data: { info } });
|
||||
const sourceFile = project.getSourceFile(scriptInfo.path);
|
||||
const checkJs = !!sourceFile && !!sourceFile.checkJsDirective;
|
||||
this.eventHandler({ eventName: OpenFileInfoTelemetryEvent, data: { info: { checkJs } } });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+12
-2
@@ -384,7 +384,9 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
getScriptVersion(filename: string) {
|
||||
const info = this.getOrCreateScriptInfoAndAttachToProject(filename);
|
||||
// Don't attach to the project if version is asked
|
||||
|
||||
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(filename, this.currentDirectory, this.directoryStructureHost);
|
||||
return (info && info.getLatestVersion())!; // TODO: GH#18217
|
||||
}
|
||||
|
||||
@@ -558,6 +560,11 @@ namespace ts.server {
|
||||
return this.getLanguageService().getSourceMapper();
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
clearSourceMapperCache() {
|
||||
this.languageService.clearSourceMapperCache();
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
getDocumentPositionMapper(generatedFileName: string, sourceFileName?: string): DocumentPositionMapper | undefined {
|
||||
return this.projectService.getDocumentPositionMapper(this, generatedFileName, sourceFileName);
|
||||
@@ -1224,7 +1231,10 @@ namespace ts.server {
|
||||
watcher: this.projectService.watchFactory.watchFile(
|
||||
this.projectService.host,
|
||||
generatedFile,
|
||||
() => this.projectService.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(this),
|
||||
() => {
|
||||
this.clearSourceMapperCache();
|
||||
this.projectService.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(this);
|
||||
},
|
||||
PollingInterval.High,
|
||||
this.projectService.getWatchOptions(this),
|
||||
WatchType.MissingGeneratedFile,
|
||||
|
||||
@@ -557,6 +557,8 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
getLatestVersion() {
|
||||
// Ensure we have updated snapshot to give back latest version
|
||||
this.textStorage.getSnapshot();
|
||||
return this.textStorage.getVersion();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace ts.OutliningElementsCollector {
|
||||
function addNodeOutliningSpans(sourceFile: SourceFile, cancellationToken: CancellationToken, out: Push<OutliningSpan>): void {
|
||||
let depthRemaining = 40;
|
||||
let current = 0;
|
||||
const statements = sourceFile.statements;
|
||||
// Includes the EOF Token so that comments which aren't attached to statements are included
|
||||
const statements = [...sourceFile.statements, sourceFile.endOfFileToken];
|
||||
const n = statements.length;
|
||||
while (current < n) {
|
||||
while (current < n && !isAnyImportSyntax(statements[current])) {
|
||||
@@ -33,7 +34,7 @@ namespace ts.OutliningElementsCollector {
|
||||
if (depthRemaining === 0) return;
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
|
||||
if (isDeclaration(n)) {
|
||||
if (isDeclaration(n) || n.kind === SyntaxKind.EndOfFileToken) {
|
||||
addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out);
|
||||
}
|
||||
|
||||
|
||||
@@ -980,11 +980,6 @@ namespace ts {
|
||||
return names;
|
||||
}
|
||||
|
||||
public getVersion(path: Path): string {
|
||||
const file = this.getHostFileInformation(path);
|
||||
return (file && file.version)!; // TODO: GH#18217
|
||||
}
|
||||
|
||||
public getScriptSnapshot(path: Path): IScriptSnapshot {
|
||||
const file = this.getHostFileInformation(path);
|
||||
return (file && file.scriptSnapshot)!; // TODO: GH#18217
|
||||
@@ -1228,7 +1223,7 @@ namespace ts {
|
||||
const projectReferences = hostCache.getProjectReferences();
|
||||
|
||||
// If the program is already up-to-date, we can reuse it
|
||||
if (isProgramUptoDate(program, rootFileNames, hostCache.compilationSettings(), path => hostCache!.getVersion(path), fileExists, hasInvalidatedResolution, !!host.hasChangedAutomaticTypeDirectiveNames, projectReferences)) {
|
||||
if (isProgramUptoDate(program, rootFileNames, hostCache.compilationSettings(), (_path, fileName) => host.getScriptVersion(fileName), fileExists, hasInvalidatedResolution, !!host.hasChangedAutomaticTypeDirectiveNames, projectReferences)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2227,6 +2222,7 @@ namespace ts {
|
||||
getEditsForRefactor,
|
||||
toLineColumnOffset: sourceMapper.toLineColumnOffset,
|
||||
getSourceMapper: () => sourceMapper,
|
||||
clearSourceMapperCache: () => sourceMapper.clearCache(),
|
||||
prepareCallHierarchy,
|
||||
provideCallHierarchyIncomingCalls,
|
||||
provideCallHierarchyOutgoingCalls
|
||||
|
||||
@@ -382,6 +382,8 @@ namespace ts {
|
||||
toLineColumnOffset?(fileName: string, position: number): LineAndCharacter;
|
||||
/** @internal */
|
||||
getSourceMapper(): SourceMapper;
|
||||
/** @internal */
|
||||
clearSourceMapperCache(): void;
|
||||
|
||||
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: readonly number[], formatOptions: FormatCodeSettings, preferences: UserPreferences): readonly CodeFixAction[];
|
||||
getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, preferences: UserPreferences): CombinedCodeActions;
|
||||
|
||||
@@ -80,5 +80,61 @@ export function Component(x: Config): any;`
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
describe("detects program upto date correctly", () => {
|
||||
function verifyProgramUptoDate(useProjectVersion: boolean) {
|
||||
let projectVersion = "1";
|
||||
const files = createMap<{ version: string, text: string; }>();
|
||||
files.set("/project/root.ts", { version: "1", text: `import { foo } from "./other"` });
|
||||
files.set("/project/other.ts", { version: "1", text: `export function foo() { }` });
|
||||
files.set("/lib/lib.d.ts", { version: "1", text: projectSystem.libFile.content });
|
||||
const host: LanguageServiceHost = {
|
||||
useCaseSensitiveFileNames: returnTrue,
|
||||
getCompilationSettings: getDefaultCompilerOptions,
|
||||
fileExists: path => files.has(path),
|
||||
getProjectVersion: !useProjectVersion ? undefined : () => projectVersion,
|
||||
getScriptFileNames: () => ["/project/root.ts"],
|
||||
getScriptVersion: path => files.get(path)?.version || "",
|
||||
getScriptSnapshot: path => {
|
||||
const text = files.get(path)?.text;
|
||||
return text ? ScriptSnapshot.fromString(text) : undefined;
|
||||
},
|
||||
getCurrentDirectory: () => "/project",
|
||||
getDefaultLibFileName: () => "/lib/lib.d.ts"
|
||||
};
|
||||
const ls = ts.createLanguageService(host);
|
||||
const program1 = ls.getProgram()!;
|
||||
const program2 = ls.getProgram()!;
|
||||
assert.strictEqual(program1, program2);
|
||||
verifyProgramFiles(program1);
|
||||
|
||||
// Change other
|
||||
projectVersion = "2";
|
||||
files.set("/project/other.ts", { version: "2", text: `export function foo() { } export function bar() { }` });
|
||||
const program3 = ls.getProgram()!;
|
||||
assert.notStrictEqual(program2, program3);
|
||||
verifyProgramFiles(program3);
|
||||
|
||||
// change root
|
||||
projectVersion = "3";
|
||||
files.set("/project/root.ts", { version: "2", text: `import { foo, bar } from "./other"` });
|
||||
const program4 = ls.getProgram()!;
|
||||
assert.notStrictEqual(program3, program4);
|
||||
verifyProgramFiles(program4);
|
||||
|
||||
function verifyProgramFiles(program: Program) {
|
||||
assert.deepEqual(
|
||||
program.getSourceFiles().map(f => f.fileName),
|
||||
["/lib/lib.d.ts", "/project/other.ts", "/project/root.ts"]
|
||||
);
|
||||
}
|
||||
}
|
||||
it("when host implements getProjectVersion", () => {
|
||||
verifyProgramUptoDate(/*useProjectVersion*/ true);
|
||||
});
|
||||
it("when host does not implement getProjectVersion", () => {
|
||||
verifyProgramUptoDate(/*useProjectVersion*/ false);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ fn5();
|
||||
interface VerifierAndWithRefs {
|
||||
withRefs: boolean;
|
||||
disableSourceOfProjectReferenceRedirect?: true;
|
||||
verifier: (withRefs: boolean) => readonly DocumentPositionMapperVerifier[];
|
||||
verifier: (withRefs: boolean, disableSourceOfProjectReferenceRedirect?: true) => readonly DocumentPositionMapperVerifier[];
|
||||
}
|
||||
|
||||
function openFiles(verifiers: readonly DocumentPositionMapperVerifier[]) {
|
||||
@@ -502,7 +502,7 @@ fn5();
|
||||
onHostCreate(host);
|
||||
}
|
||||
const session = createSession(host);
|
||||
const verifiers = verifier(withRefs && !disableSourceOfProjectReferenceRedirect);
|
||||
const verifiers = verifier(withRefs && !disableSourceOfProjectReferenceRedirect, disableSourceOfProjectReferenceRedirect);
|
||||
openFilesForSession([...openFiles(verifiers), randomFile], session);
|
||||
return { host, session, verifiers };
|
||||
}
|
||||
@@ -724,13 +724,14 @@ fn5();
|
||||
scenarioName,
|
||||
verifier,
|
||||
withRefs,
|
||||
disableSourceOfProjectReferenceRedirect,
|
||||
change,
|
||||
afterChangeActionKey
|
||||
}: VerifyScenarioWithChanges,
|
||||
timeoutBeforeAction: boolean,
|
||||
) {
|
||||
it(scenarioName, () => {
|
||||
const { host, session, verifiers } = openTsFile({ verifier, withRefs });
|
||||
const { host, session, verifiers } = openTsFile({ verifier, withRefs, disableSourceOfProjectReferenceRedirect });
|
||||
|
||||
// Create DocumentPositionMapper
|
||||
firstAction(session, verifiers);
|
||||
@@ -790,6 +791,7 @@ fn5();
|
||||
scenarioName,
|
||||
verifier,
|
||||
withRefs,
|
||||
disableSourceOfProjectReferenceRedirect,
|
||||
fileLocation,
|
||||
fileNotPresentKey,
|
||||
fileCreatedKey,
|
||||
@@ -801,6 +803,7 @@ fn5();
|
||||
const { host, session, verifiers } = openTsFile({
|
||||
verifier,
|
||||
withRefs,
|
||||
disableSourceOfProjectReferenceRedirect,
|
||||
onHostCreate: host => host.deleteFile(fileLocation)
|
||||
});
|
||||
checkProject(session, verifiers, noDts);
|
||||
@@ -813,6 +816,7 @@ fn5();
|
||||
const { host, session, verifiers } = openTsFile({
|
||||
verifier,
|
||||
withRefs,
|
||||
disableSourceOfProjectReferenceRedirect,
|
||||
onHostCreate: host => {
|
||||
fileContents = host.readFile(fileLocation);
|
||||
host.deleteFile(fileLocation);
|
||||
@@ -825,7 +829,7 @@ fn5();
|
||||
});
|
||||
|
||||
it("when file is deleted after actions on the projects", () => {
|
||||
const { host, session, verifiers } = openTsFile({ verifier, withRefs });
|
||||
const { host, session, verifiers } = openTsFile({ verifier, disableSourceOfProjectReferenceRedirect, withRefs });
|
||||
firstAction(session, verifiers);
|
||||
|
||||
// The dependency file is deleted when orphan files are collected
|
||||
@@ -967,31 +971,35 @@ ${dependencyTs.content}`);
|
||||
|
||||
interface VerifyScenario {
|
||||
mainScenario: string;
|
||||
verifier: (withRefs: boolean) => readonly DocumentPositionMapperVerifier[];
|
||||
verifier: (withRefs: boolean, disableSourceOfProjectReferenceRedirect?: true) => readonly DocumentPositionMapperVerifier[];
|
||||
}
|
||||
function verifyScenario(scenario: VerifyScenario) {
|
||||
describe("when main tsconfig doesnt have project reference", () => {
|
||||
verifyScenarioWorker(scenario, /*withRefs*/ false);
|
||||
});
|
||||
describe("when main tsconfig has project reference", () => {
|
||||
verifyScenarioWorker(scenario, /*withRefs*/ true);
|
||||
});
|
||||
describe("when main tsconfig has but has disableSourceOfProjectReferenceRedirect", () => {
|
||||
verifyScenarioWorker(scenario, /*withRefs*/ true);
|
||||
describe(scenario.mainScenario, () => {
|
||||
describe("when main tsconfig doesnt have project reference", () => {
|
||||
verifyScenarioWorker(scenario, /*withRefs*/ false);
|
||||
});
|
||||
describe("when main tsconfig has project reference", () => {
|
||||
verifyScenarioWorker(scenario, /*withRefs*/ true);
|
||||
});
|
||||
describe("when main tsconfig has disableSourceOfProjectReferenceRedirect along with project reference", () => {
|
||||
verifyScenarioWorker(scenario, /*withRefs*/ true, /*disableSourceOfProjectReferenceRedirect*/ true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe("from project that uses dependency", () => {
|
||||
verifyScenario({
|
||||
mainScenario: "can go to definition correctly",
|
||||
verifier: withRefs => [
|
||||
verifier: (withRefs, disableSourceOfProjectReferenceRedirect) => [
|
||||
{
|
||||
...goToDefFromMainTsProjectInfoVerifier(withRefs),
|
||||
main: () => ({
|
||||
action: goToDefFromMainTs,
|
||||
closedInfos: withRefs ?
|
||||
[dependencyTs.path, dependencyConfig.path, libFile.path] :
|
||||
[dependencyTs.path, libFile.path, dtsPath, dtsMapLocation],
|
||||
disableSourceOfProjectReferenceRedirect ?
|
||||
[dependencyTs.path, libFile.path, dtsPath, dtsMapLocation, dependencyConfig.path] :
|
||||
[dependencyTs.path, libFile.path, dtsPath, dtsMapLocation],
|
||||
otherWatchedFiles: [mainConfig.path],
|
||||
expectsDts: !withRefs, // Dts script info present only if no project reference
|
||||
expectsMap: !withRefs // Map script info present only if no project reference
|
||||
@@ -1097,7 +1105,7 @@ ${dependencyTs.content}`);
|
||||
describe("when opening depedency and usage project", () => {
|
||||
verifyScenario({
|
||||
mainScenario: "goto Definition in usage and rename locations from defining project",
|
||||
verifier: withRefs => [
|
||||
verifier: (withRefs, disableSourceOfProjectReferenceRedirect) => [
|
||||
{
|
||||
...goToDefFromMainTsProjectInfoVerifier(withRefs),
|
||||
main: () => ({
|
||||
@@ -1105,9 +1113,11 @@ ${dependencyTs.content}`);
|
||||
// DependencyTs is open, so omit it from closed infos
|
||||
closedInfos: withRefs ?
|
||||
[dependencyConfig.path, libFile.path] :
|
||||
[libFile.path, dtsPath, dtsMapLocation],
|
||||
otherWatchedFiles: withRefs ?
|
||||
[mainConfig.path] : // Its in closed info
|
||||
disableSourceOfProjectReferenceRedirect ?
|
||||
[libFile.path, dtsPath, dtsMapLocation, dependencyConfig.path] :
|
||||
[libFile.path, dtsPath, dtsMapLocation],
|
||||
otherWatchedFiles: withRefs || disableSourceOfProjectReferenceRedirect ?
|
||||
[mainConfig.path] : // dependencyConfig is in closed info
|
||||
[mainConfig.path, dependencyConfig.path],
|
||||
expectsDts: !withRefs, // Dts script info present only if no project reference
|
||||
expectsMap: !withRefs // Map script info present only if no project reference
|
||||
@@ -1179,9 +1189,11 @@ ${dependencyTs.content}`);
|
||||
// DependencyTs is open, so omit it from closed infos
|
||||
closedInfos: withRefs ?
|
||||
[dependencyConfig.path, libFile.path, dtsLocation, dtsMapLocation] :
|
||||
[libFile.path, dtsPath, dtsMapLocation],
|
||||
otherWatchedFiles: withRefs ?
|
||||
[mainConfig.path] : // Its in closed info
|
||||
disableSourceOfProjectReferenceRedirect ?
|
||||
[libFile.path, dtsPath, dtsMapLocation, dependencyConfig.path] :
|
||||
[libFile.path, dtsPath, dtsMapLocation],
|
||||
otherWatchedFiles: withRefs || disableSourceOfProjectReferenceRedirect ?
|
||||
[mainConfig.path] : // dependencyConfig is in closed info
|
||||
[mainConfig.path, dependencyConfig.path],
|
||||
expectsDts: true,
|
||||
expectsMap: true,
|
||||
|
||||
+8
-4
@@ -1726,10 +1726,9 @@ declare namespace ts {
|
||||
SwitchClause = 128,
|
||||
ArrayMutation = 256,
|
||||
Call = 512,
|
||||
Referenced = 1024,
|
||||
Shared = 2048,
|
||||
PreFinally = 4096,
|
||||
AfterFinally = 8192,
|
||||
ReduceLabel = 1024,
|
||||
Referenced = 2048,
|
||||
Shared = 4096,
|
||||
Label = 12,
|
||||
Condition = 96
|
||||
}
|
||||
@@ -1776,6 +1775,11 @@ declare namespace ts {
|
||||
node: CallExpression | BinaryExpression;
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
export interface FlowReduceLabel extends FlowNodeBase {
|
||||
target: FlowLabel;
|
||||
antecedents: FlowNode[];
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
export type FlowType = Type | IncompleteType;
|
||||
export interface IncompleteType {
|
||||
flags: TypeFlags;
|
||||
|
||||
+8
-4
@@ -1726,10 +1726,9 @@ declare namespace ts {
|
||||
SwitchClause = 128,
|
||||
ArrayMutation = 256,
|
||||
Call = 512,
|
||||
Referenced = 1024,
|
||||
Shared = 2048,
|
||||
PreFinally = 4096,
|
||||
AfterFinally = 8192,
|
||||
ReduceLabel = 1024,
|
||||
Referenced = 2048,
|
||||
Shared = 4096,
|
||||
Label = 12,
|
||||
Condition = 96
|
||||
}
|
||||
@@ -1776,6 +1775,11 @@ declare namespace ts {
|
||||
node: CallExpression | BinaryExpression;
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
export interface FlowReduceLabel extends FlowNodeBase {
|
||||
target: FlowLabel;
|
||||
antecedents: FlowNode[];
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
export type FlowType = Type | IncompleteType;
|
||||
export interface IncompleteType {
|
||||
flags: TypeFlags;
|
||||
|
||||
@@ -72,6 +72,26 @@ Standard output:
|
||||
@fluentui/docs: [XX:XX:XX] Using gulpfile /office-ui-fabric-react/gulpfile.ts
|
||||
@fluentui/docs: > @fluentui/ability-attributes@X.X.X schema /office-ui-fabric-react/packages/fluentui/ability-attributes
|
||||
@fluentui/docs: > allyschema -c "process.env.NODE_ENV !== 'production'" schema.json > ./src/schema.ts
|
||||
@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/CONTRIBUTING.md" for github.com.
|
||||
@fluentui/docs: ==================
|
||||
@fluentui/docs: "/office-ui-fabric-react/.github/CONTRIBUTING.md" will be updated
|
||||
@fluentui/docs: Everything is OK.
|
||||
@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/setup-local-development.md" for github.com.
|
||||
@fluentui/docs: ==================
|
||||
@fluentui/docs: "/office-ui-fabric-react/.github/setup-local-development.md" will be updated
|
||||
@fluentui/docs: Everything is OK.
|
||||
@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/add-a-feature.md" for github.com.
|
||||
@fluentui/docs: ==================
|
||||
@fluentui/docs: "/office-ui-fabric-react/.github/add-a-feature.md" will be updated
|
||||
@fluentui/docs: Everything is OK.
|
||||
@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/document-a-feature.md" for github.com.
|
||||
@fluentui/docs: ==================
|
||||
@fluentui/docs: "/office-ui-fabric-react/.github/document-a-feature.md" will be updated
|
||||
@fluentui/docs: Everything is OK.
|
||||
@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/test-a-feature.md" for github.com.
|
||||
@fluentui/docs: ==================
|
||||
@fluentui/docs: "/office-ui-fabric-react/.github/test-a-feature.md" will be updated
|
||||
@fluentui/docs: Everything is OK.
|
||||
@fluentui/docs: Starting type checking service...
|
||||
@fluentui/docs: Using 1 worker with 2048MB memory limit
|
||||
@fluentui/docs: [XX:XX:XX] Time: ?s
|
||||
@@ -95,9 +115,6 @@ Standard output:
|
||||
|
||||
Standard error:
|
||||
info cli using local version of lerna
|
||||
lerna notice cli vX.X.X
|
||||
lerna info ci enabled
|
||||
lerna info Executing command in 62 packages: "yarn run build"
|
||||
@fluentui/ability-attributes: npm WARN lifecycle The node binary used for scripts is but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
|
||||
@uifabric/example-data: [XX:XX:XX XM] ▲ One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect
|
||||
@uifabric/set-version: [XX:XX:XX XM] ▲ One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect
|
||||
@@ -118,4 +135,3 @@ lerna info Executing command in 62 packages: "yarn run build"
|
||||
@fluentui/docs: [XX:XX:XX] 'build:docs' errored after
|
||||
@fluentui/docs: error Command failed with exit code 1.
|
||||
lerna ERR! yarn run build exited 1 in '@fluentui/docs'
|
||||
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Exit Code: 0
|
||||
Standard output:
|
||||
|
||||
> @ build /vue-next
|
||||
> @X.X.X-alpha.6 build /vue-next
|
||||
> node scripts/build.js "--types"
|
||||
Rolling up type definitions for compiler-core...
|
||||
Writing: /vue-next/temp/compiler-core.api.json
|
||||
@@ -13,6 +13,16 @@ Writing: /vue-next/temp/compiler-dom.api.json
|
||||
The API report is up to date: temp/compiler-dom.api.md
|
||||
Writing package typings: /vue-next/packages/compiler-dom/dist/compiler-dom.d.ts
|
||||
API Extractor completed successfully.
|
||||
Rolling up type definitions for compiler-sfc...
|
||||
Writing: /vue-next/temp/compiler-sfc.api.json
|
||||
The API report is up to date: temp/compiler-sfc.api.md
|
||||
Writing package typings: /vue-next/packages/compiler-sfc/dist/compiler-sfc.d.ts
|
||||
API Extractor completed successfully.
|
||||
Rolling up type definitions for compiler-ssr...
|
||||
Writing: /vue-next/temp/compiler-ssr.api.json
|
||||
The API report is up to date: temp/compiler-ssr.api.md
|
||||
Writing package typings: /vue-next/packages/compiler-ssr/dist/compiler-ssr.d.ts
|
||||
API Extractor completed successfully.
|
||||
Rolling up type definitions for reactivity...
|
||||
Writing: /vue-next/temp/reactivity.api.json
|
||||
The API report is up to date: temp/reactivity.api.md
|
||||
@@ -34,93 +44,110 @@ The API report is up to date: temp/runtime-test.api.md
|
||||
Writing package typings: /vue-next/packages/runtime-test/dist/runtime-test.d.ts
|
||||
API Extractor completed successfully.
|
||||
Rolling up type definitions for server-renderer...
|
||||
Writing: /vue-next/temp/server-renderer.api.json
|
||||
The API report is up to date: temp/server-renderer.api.md
|
||||
Writing package typings: /vue-next/packages/server-renderer/dist/server-renderer.d.ts
|
||||
API Extractor completed successfully.
|
||||
|
||||
|
||||
|
||||
Standard error:
|
||||
|
||||
/vue-next/packages/compiler-core/src/index.ts → packages/compiler-core/dist/compiler-core.esm-bundler.js...
|
||||
created packages/compiler-core/dist/compiler-core.esm-bundler.js in ?s
|
||||
/vue-next/packages/compiler-core/src/index.ts → packages/compiler-core/dist/compiler-core.cjs.js...
|
||||
created packages/compiler-core/dist/compiler-core.cjs.js in ?s
|
||||
/vue-next/packages/compiler-core/src/index.ts → packages/compiler-core/dist/compiler-core.cjs.prod.js...
|
||||
created packages/compiler-core/dist/compiler-core.cjs.prod.js in ?s
|
||||
/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm-bundler.js...
|
||||
created packages/compiler-dom/dist/compiler-dom.esm-bundler.js in ?s
|
||||
/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.cjs.js...
|
||||
created packages/compiler-dom/dist/compiler-dom.cjs.js in ?s
|
||||
/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.global.js...
|
||||
created packages/compiler-dom/dist/compiler-dom.global.js in ?s
|
||||
/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm-browser.js...
|
||||
created packages/compiler-dom/dist/compiler-dom.esm-browser.js in ?s
|
||||
/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm.js...
|
||||
created packages/compiler-dom/dist/compiler-dom.esm.js in ?s
|
||||
/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.cjs.prod.js...
|
||||
created packages/compiler-dom/dist/compiler-dom.cjs.prod.js in ?s
|
||||
/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.global.prod.js...
|
||||
created packages/compiler-dom/dist/compiler-dom.global.prod.js in ?s
|
||||
/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm-browser.prod.js...
|
||||
created packages/compiler-dom/dist/compiler-dom.esm-browser.prod.js in ?s
|
||||
Warning: /vue-next/packages/compiler-core/src/transforms/vFor.ts:122:37 - (TS2339) Property 'codegenNode' does not exist on type 'TemplateChildNode'.; Property 'codegenNode' does not exist on type 'CompoundExpressionNode'.
|
||||
/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm.prod.js...
|
||||
created packages/compiler-dom/dist/compiler-dom.esm.prod.js in ?s
|
||||
/vue-next/packages/compiler-sfc/src/index.ts → packages/compiler-sfc/dist/compiler-sfc.cjs.js...
|
||||
(!) Unresolved dependencies
|
||||
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
|
||||
url (imported by packages/compiler-sfc/src/templateUtils.ts)
|
||||
created packages/compiler-sfc/dist/compiler-sfc.cjs.js in ?s
|
||||
/vue-next/packages/compiler-ssr/src/index.ts → packages/compiler-ssr/dist/compiler-ssr.cjs.js...
|
||||
created packages/compiler-ssr/dist/compiler-ssr.cjs.js in ?s
|
||||
/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm-bundler.js...
|
||||
created packages/reactivity/dist/reactivity.esm-bundler.js in ?s
|
||||
/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.cjs.js...
|
||||
created packages/reactivity/dist/reactivity.cjs.js in ?s
|
||||
/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.global.js...
|
||||
created packages/reactivity/dist/reactivity.global.js in ?s
|
||||
/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm-browser.js...
|
||||
created packages/reactivity/dist/reactivity.esm-browser.js in ?s
|
||||
/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm.js...
|
||||
created packages/reactivity/dist/reactivity.esm.js in ?s
|
||||
/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.cjs.prod.js...
|
||||
created packages/reactivity/dist/reactivity.cjs.prod.js in ?s
|
||||
/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.global.prod.js...
|
||||
created packages/reactivity/dist/reactivity.global.prod.js in ?s
|
||||
/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm-browser.prod.js...
|
||||
created packages/reactivity/dist/reactivity.esm-browser.prod.js in ?s
|
||||
/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm.prod.js...
|
||||
created packages/reactivity/dist/reactivity.esm.prod.js in ?s
|
||||
/vue-next/packages/runtime-core/src/index.ts → packages/runtime-core/dist/runtime-core.esm-bundler.js...
|
||||
created packages/runtime-core/dist/runtime-core.esm-bundler.js in ?s
|
||||
/vue-next/packages/runtime-core/src/index.ts → packages/runtime-core/dist/runtime-core.cjs.js...
|
||||
created packages/runtime-core/dist/runtime-core.cjs.js in ?s
|
||||
/vue-next/packages/runtime-core/src/index.ts → packages/runtime-core/dist/runtime-core.cjs.prod.js...
|
||||
created packages/runtime-core/dist/runtime-core.cjs.prod.js in ?s
|
||||
Warning: /vue-next/packages/compiler-core/src/transforms/vFor.ts:122:37 - (TS2339) Property 'codegenNode' does not exist on type 'TemplateChildNode'.; Property 'codegenNode' does not exist on type 'CompoundExpressionNode'.
|
||||
/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm-bundler.js...
|
||||
created packages/runtime-dom/dist/runtime-dom.esm-bundler.js in ?s
|
||||
/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.cjs.js...
|
||||
created packages/runtime-dom/dist/runtime-dom.cjs.js in ?s
|
||||
/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.global.js...
|
||||
created packages/runtime-dom/dist/runtime-dom.global.js in ?s
|
||||
/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm-browser.js...
|
||||
created packages/runtime-dom/dist/runtime-dom.esm-browser.js in ?s
|
||||
/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm.js...
|
||||
created packages/runtime-dom/dist/runtime-dom.esm.js in ?s
|
||||
/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.cjs.prod.js...
|
||||
created packages/runtime-dom/dist/runtime-dom.cjs.prod.js in ?s
|
||||
/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.global.prod.js...
|
||||
created packages/runtime-dom/dist/runtime-dom.global.prod.js in ?s
|
||||
/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm-browser.prod.js...
|
||||
created packages/runtime-dom/dist/runtime-dom.esm-browser.prod.js in ?s
|
||||
Warning: /vue-next/packages/compiler-core/src/transforms/vFor.ts:122:37 - (TS2339) Property 'codegenNode' does not exist on type 'TemplateChildNode'.; Property 'codegenNode' does not exist on type 'CompoundExpressionNode'.
|
||||
Warning: /vue-next/packages/runtime-core/src/component.ts:322:19 - (TS7006) Parameter 'err' implicitly has an 'any' type.
|
||||
/vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.esm-bundler.js...
|
||||
created packages/runtime-test/dist/runtime-test.esm-bundler.js in ?s
|
||||
/vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.cjs.js...
|
||||
created packages/runtime-test/dist/runtime-test.cjs.js in ?s
|
||||
/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm.prod.js...
|
||||
created packages/runtime-dom/dist/runtime-dom.esm.prod.js in ?s
|
||||
/vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.global.js...
|
||||
created packages/runtime-test/dist/runtime-test.global.js in ?s
|
||||
/vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.cjs.prod.js...
|
||||
created packages/runtime-test/dist/runtime-test.cjs.prod.js in ?s
|
||||
/vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.global.prod.js...
|
||||
created packages/runtime-test/dist/runtime-test.global.prod.js in ?s
|
||||
Warning: /vue-next/packages/compiler-core/src/transforms/vFor.ts:122:37 - (TS2339) Property 'codegenNode' does not exist on type 'TemplateChildNode'.; Property 'codegenNode' does not exist on type 'CompoundExpressionNode'.
|
||||
Warning: /vue-next/packages/runtime-core/src/component.ts:322:19 - (TS7006) Parameter 'err' implicitly has an 'any' type.
|
||||
/vue-next/packages/server-renderer/src/index.ts → packages/server-renderer/dist/server-renderer.cjs.js...
|
||||
(!) Generated an empty bundle
|
||||
created packages/server-renderer/dist/server-renderer.cjs.js in ?s
|
||||
/vue-next/packages/server-renderer/src/index.ts → packages/server-renderer/dist/server-renderer.cjs.prod.js...
|
||||
(!) Generated an empty bundle
|
||||
created packages/server-renderer/dist/server-renderer.cjs.prod.js in ?s
|
||||
(node:18) UnhandledPromiseRejectionWarning: Error: Internal Error: Unable to determine module for: /vue-next/packages/server-renderer/dist/packages/server-renderer/src/index.d.ts
|
||||
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
|
||||
at ExportAnalyzer._getModuleSymbolFromSourceFile (/vue-next/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:146:15)
|
||||
at ExportAnalyzer.fetchAstModuleFromSourceFile (/vue-next/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:41:35)
|
||||
at AstSymbolTable.fetchAstModuleFromWorkingPackage (/vue-next/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:53:37)
|
||||
at Collector.analyze (/vue-next/node_modules/@microsoft/api-extractor/lib/collector/Collector.js:114:51)
|
||||
at Function.invoke (/vue-next/node_modules/@microsoft/api-extractor/lib/api/Extractor.js:97:19)
|
||||
at build (/vue-next/scripts/build.js:91:30)
|
||||
at processTicksAndRejections (internal/process/task_queues.js:89:5)
|
||||
at async buildAll (/vue-next/scripts/build.js:45:5)
|
||||
at async /vue-next/scripts/build.js:35:5
|
||||
(node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
|
||||
(node:18) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
|
||||
/vue-next/packages/size-check/src/index.ts → packages/size-check/dist/size-check.global.js...
|
||||
created packages/size-check/dist/size-check.global.js in ?s
|
||||
/vue-next/packages/size-check/src/index.ts → packages/size-check/dist/size-check.global.prod.js...
|
||||
created packages/size-check/dist/size-check.global.prod.js in ?s
|
||||
/vue-next/packages/template-explorer/src/index.ts → packages/template-explorer/dist/template-explorer.global.js...
|
||||
created packages/template-explorer/dist/template-explorer.global.js in ?s
|
||||
/vue-next/packages/vue/src/index.ts → packages/vue/dist/vue.esm-bundler.js...
|
||||
[!] (plugin rpt2) Error: /vue-next/packages/vue/src/devCheck.ts(2,11): semantic error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
|
||||
packages/vue/src/devCheck.ts
|
||||
Error: /vue-next/packages/vue/src/devCheck.ts(2,11): semantic error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
|
||||
at error (/vue-next/node_modules/rollup/dist/shared/node-entry.js:5400:30)
|
||||
at throwPluginError (/vue-next/node_modules/rollup/dist/shared/node-entry.js:11874:12)
|
||||
at Object.error (/vue-next/node_modules/rollup/dist/shared/node-entry.js:12908:24)
|
||||
at Object.error (/vue-next/node_modules/rollup/dist/shared/node-entry.js:12077:38)
|
||||
at RollupContext.error (/vue-next/node_modules/rollup-plugin-typescript2/src/rollupcontext.ts:37:18)
|
||||
at /vue-next/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:41:11
|
||||
at arrayEach (/vue-next/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:516:11)
|
||||
at forEach (/vue-next/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:9342:14)
|
||||
at _.each (/vue-next/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:9:2)
|
||||
at Object.transform (/vue-next/node_modules/rollup-plugin-typescript2/src/index.ts:234:5)
|
||||
(node:17) UnhandledPromiseRejectionWarning: Error: Command failed with exit code 1 (EPERM): rollup -c --environment COMMIT:d4c6957,NODE_ENV:production,TARGET:vue,TYPES:true
|
||||
at makeError (/vue-next/node_modules/execa/lib/error.js:59:11)
|
||||
at handlePromise (/vue-next/node_modules/execa/index.js:112:26)
|
||||
at processTicksAndRejections (internal/process/task_queues.js:97:5)
|
||||
at async build (/vue-next/scripts/build.js:72:3)
|
||||
at async buildAll (/vue-next/scripts/build.js:51:5)
|
||||
at async run (/vue-next/scripts/build.js:41:5)
|
||||
(node:17) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
|
||||
(node:17) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//// [indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts]
|
||||
type AnyFunction = (...args: any[]) => any;
|
||||
type Params<T> = Parameters<Extract<T, AnyFunction>>;
|
||||
|
||||
interface Wrapper<T> {
|
||||
call<K extends keyof T>(event: K, ...args: Params<T[K]>): void;
|
||||
}
|
||||
|
||||
interface AWrapped {
|
||||
foo(): void;
|
||||
}
|
||||
|
||||
class A {
|
||||
foo: Wrapper<AWrapped>;
|
||||
}
|
||||
|
||||
interface BWrapped extends AWrapped {
|
||||
bar(): void;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
foo: Wrapper<BWrapped>;
|
||||
}
|
||||
|
||||
//// [indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.js]
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var A = /** @class */ (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = /** @class */ (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
=== tests/cases/compiler/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts ===
|
||||
type AnyFunction = (...args: any[]) => any;
|
||||
>AnyFunction : Symbol(AnyFunction, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 0))
|
||||
>args : Symbol(args, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 20))
|
||||
|
||||
type Params<T> = Parameters<Extract<T, AnyFunction>>;
|
||||
>Params : Symbol(Params, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 43))
|
||||
>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 12))
|
||||
>Parameters : Symbol(Parameters, Decl(lib.es5.d.ts, --, --))
|
||||
>Extract : Symbol(Extract, Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 12))
|
||||
>AnyFunction : Symbol(AnyFunction, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 0))
|
||||
|
||||
interface Wrapper<T> {
|
||||
>Wrapper : Symbol(Wrapper, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 53))
|
||||
>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 3, 18))
|
||||
|
||||
call<K extends keyof T>(event: K, ...args: Params<T[K]>): void;
|
||||
>call : Symbol(Wrapper.call, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 3, 22))
|
||||
>K : Symbol(K, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 6))
|
||||
>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 3, 18))
|
||||
>event : Symbol(event, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 25))
|
||||
>K : Symbol(K, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 6))
|
||||
>args : Symbol(args, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 34))
|
||||
>Params : Symbol(Params, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 43))
|
||||
>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 3, 18))
|
||||
>K : Symbol(K, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 6))
|
||||
}
|
||||
|
||||
interface AWrapped {
|
||||
>AWrapped : Symbol(AWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 5, 1))
|
||||
|
||||
foo(): void;
|
||||
>foo : Symbol(AWrapped.foo, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 7, 20))
|
||||
}
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 9, 1))
|
||||
|
||||
foo: Wrapper<AWrapped>;
|
||||
>foo : Symbol(A.foo, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 11, 9))
|
||||
>Wrapper : Symbol(Wrapper, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 53))
|
||||
>AWrapped : Symbol(AWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 5, 1))
|
||||
}
|
||||
|
||||
interface BWrapped extends AWrapped {
|
||||
>BWrapped : Symbol(BWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 13, 1))
|
||||
>AWrapped : Symbol(AWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 5, 1))
|
||||
|
||||
bar(): void;
|
||||
>bar : Symbol(BWrapped.bar, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 15, 37))
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
>B : Symbol(B, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 17, 1))
|
||||
>A : Symbol(A, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 9, 1))
|
||||
|
||||
foo: Wrapper<BWrapped>;
|
||||
>foo : Symbol(B.foo, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 19, 19))
|
||||
>Wrapper : Symbol(Wrapper, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 53))
|
||||
>BWrapped : Symbol(BWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 13, 1))
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
=== tests/cases/compiler/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts ===
|
||||
type AnyFunction = (...args: any[]) => any;
|
||||
>AnyFunction : AnyFunction
|
||||
>args : any[]
|
||||
|
||||
type Params<T> = Parameters<Extract<T, AnyFunction>>;
|
||||
>Params : Parameters<Extract<T, AnyFunction>>
|
||||
|
||||
interface Wrapper<T> {
|
||||
call<K extends keyof T>(event: K, ...args: Params<T[K]>): void;
|
||||
>call : <K extends keyof T>(event: K, ...args: Parameters<Extract<T[K], AnyFunction>>) => void
|
||||
>event : K
|
||||
>args : Parameters<Extract<T[K], AnyFunction>>
|
||||
}
|
||||
|
||||
interface AWrapped {
|
||||
foo(): void;
|
||||
>foo : () => void
|
||||
}
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
foo: Wrapper<AWrapped>;
|
||||
>foo : Wrapper<AWrapped>
|
||||
}
|
||||
|
||||
interface BWrapped extends AWrapped {
|
||||
bar(): void;
|
||||
>bar : () => void
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
foo: Wrapper<BWrapped>;
|
||||
>foo : Wrapper<BWrapped>
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx(19,12): error TS6229: Tag 'MyComp4' expects at least '4' arguments, but the JSX factory 'React.createElement' provides at most '2'.
|
||||
tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx(20,12): error TS6229: Tag 'MyComp3' expects at least '3' arguments, but the JSX factory 'React.createElement' provides at most '2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx (2 errors) ====
|
||||
/// <reference path="/.lib/react16.d.ts" />
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
interface MyProps {
|
||||
x: number;
|
||||
}
|
||||
|
||||
function MyComp4(props: MyProps, context: any, bad: any, verybad: any) {
|
||||
return <div></div>;
|
||||
}
|
||||
function MyComp3(props: MyProps, context: any, bad: any) {
|
||||
return <div></div>;
|
||||
}
|
||||
function MyComp2(props: MyProps, context: any) {
|
||||
return <div></div>
|
||||
}
|
||||
|
||||
const a = <MyComp4 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
~~~~~~~
|
||||
!!! error TS6229: Tag 'MyComp4' expects at least '4' arguments, but the JSX factory 'React.createElement' provides at most '2'.
|
||||
!!! related TS2728 tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx:9:10: 'MyComp4' is declared here.
|
||||
const b = <MyComp3 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
~~~~~~~
|
||||
!!! error TS6229: Tag 'MyComp3' expects at least '3' arguments, but the JSX factory 'React.createElement' provides at most '2'.
|
||||
!!! related TS2728 tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx:12:10: 'MyComp3' is declared here.
|
||||
const c = <MyComp2 x={2}/>; // Should be OK, `context` is allowed, per react rules
|
||||
|
||||
declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element;
|
||||
const d = <MyTagWithOptionalNonJSXBits x={2} />; // Technically OK, but probably questionable
|
||||
@@ -0,0 +1,44 @@
|
||||
//// [jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx]
|
||||
/// <reference path="/.lib/react16.d.ts" />
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
interface MyProps {
|
||||
x: number;
|
||||
}
|
||||
|
||||
function MyComp4(props: MyProps, context: any, bad: any, verybad: any) {
|
||||
return <div></div>;
|
||||
}
|
||||
function MyComp3(props: MyProps, context: any, bad: any) {
|
||||
return <div></div>;
|
||||
}
|
||||
function MyComp2(props: MyProps, context: any) {
|
||||
return <div></div>
|
||||
}
|
||||
|
||||
const a = <MyComp4 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
const b = <MyComp3 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
const c = <MyComp2 x={2}/>; // Should be OK, `context` is allowed, per react rules
|
||||
|
||||
declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element;
|
||||
const d = <MyTagWithOptionalNonJSXBits x={2} />; // Technically OK, but probably questionable
|
||||
|
||||
//// [jsxIssuesErrorWhenTagExpectsTooManyArguments.js]
|
||||
"use strict";
|
||||
/// <reference path="react16.d.ts" />
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
function MyComp4(props, context, bad, verybad) {
|
||||
return React.createElement("div", null);
|
||||
}
|
||||
function MyComp3(props, context, bad) {
|
||||
return React.createElement("div", null);
|
||||
}
|
||||
function MyComp2(props, context) {
|
||||
return React.createElement("div", null);
|
||||
}
|
||||
var a = React.createElement(MyComp4, { x: 2 }); // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
var b = React.createElement(MyComp3, { x: 2 }); // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
var c = React.createElement(MyComp2, { x: 2 }); // Should be OK, `context` is allowed, per react rules
|
||||
var d = React.createElement(MyTagWithOptionalNonJSXBits, { x: 2 }); // Technically OK, but probably questionable
|
||||
@@ -0,0 +1,76 @@
|
||||
=== tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx ===
|
||||
/// <reference path="react16.d.ts" />
|
||||
|
||||
import * as React from "react";
|
||||
>React : Symbol(React, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 6))
|
||||
|
||||
interface MyProps {
|
||||
>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31))
|
||||
|
||||
x: number;
|
||||
>x : Symbol(MyProps.x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 4, 19))
|
||||
}
|
||||
|
||||
function MyComp4(props: MyProps, context: any, bad: any, verybad: any) {
|
||||
>MyComp4 : Symbol(MyComp4, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 6, 1))
|
||||
>props : Symbol(props, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 8, 17))
|
||||
>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31))
|
||||
>context : Symbol(context, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 8, 32))
|
||||
>bad : Symbol(bad, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 8, 46))
|
||||
>verybad : Symbol(verybad, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 8, 56))
|
||||
|
||||
return <div></div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114))
|
||||
}
|
||||
function MyComp3(props: MyProps, context: any, bad: any) {
|
||||
>MyComp3 : Symbol(MyComp3, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 10, 1))
|
||||
>props : Symbol(props, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 11, 17))
|
||||
>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31))
|
||||
>context : Symbol(context, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 11, 32))
|
||||
>bad : Symbol(bad, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 11, 46))
|
||||
|
||||
return <div></div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114))
|
||||
}
|
||||
function MyComp2(props: MyProps, context: any) {
|
||||
>MyComp2 : Symbol(MyComp2, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 13, 1))
|
||||
>props : Symbol(props, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 14, 17))
|
||||
>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31))
|
||||
>context : Symbol(context, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 14, 32))
|
||||
|
||||
return <div></div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114))
|
||||
}
|
||||
|
||||
const a = <MyComp4 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
>a : Symbol(a, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 18, 5))
|
||||
>MyComp4 : Symbol(MyComp4, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 6, 1))
|
||||
>x : Symbol(x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 18, 18))
|
||||
|
||||
const b = <MyComp3 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
>b : Symbol(b, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 19, 5))
|
||||
>MyComp3 : Symbol(MyComp3, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 10, 1))
|
||||
>x : Symbol(x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 19, 18))
|
||||
|
||||
const c = <MyComp2 x={2}/>; // Should be OK, `context` is allowed, per react rules
|
||||
>c : Symbol(c, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 20, 5))
|
||||
>MyComp2 : Symbol(MyComp2, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 13, 1))
|
||||
>x : Symbol(x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 20, 19))
|
||||
|
||||
declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element;
|
||||
>MyTagWithOptionalNonJSXBits : Symbol(MyTagWithOptionalNonJSXBits, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 20, 28))
|
||||
>props : Symbol(props, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 22, 45))
|
||||
>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31))
|
||||
>context : Symbol(context, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 22, 60))
|
||||
>nonReactArg : Symbol(nonReactArg, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 22, 74))
|
||||
>JSX : Symbol(JSX, Decl(react16.d.ts, 2367, 12))
|
||||
>Element : Symbol(JSX.Element, Decl(react16.d.ts, 2368, 23))
|
||||
|
||||
const d = <MyTagWithOptionalNonJSXBits x={2} />; // Technically OK, but probably questionable
|
||||
>d : Symbol(d, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 23, 5))
|
||||
>MyTagWithOptionalNonJSXBits : Symbol(MyTagWithOptionalNonJSXBits, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 20, 28))
|
||||
>x : Symbol(x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 23, 38))
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
=== tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx ===
|
||||
/// <reference path="react16.d.ts" />
|
||||
|
||||
import * as React from "react";
|
||||
>React : typeof React
|
||||
|
||||
interface MyProps {
|
||||
x: number;
|
||||
>x : number
|
||||
}
|
||||
|
||||
function MyComp4(props: MyProps, context: any, bad: any, verybad: any) {
|
||||
>MyComp4 : (props: MyProps, context: any, bad: any, verybad: any) => JSX.Element
|
||||
>props : MyProps
|
||||
>context : any
|
||||
>bad : any
|
||||
>verybad : any
|
||||
|
||||
return <div></div>;
|
||||
><div></div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
}
|
||||
function MyComp3(props: MyProps, context: any, bad: any) {
|
||||
>MyComp3 : (props: MyProps, context: any, bad: any) => JSX.Element
|
||||
>props : MyProps
|
||||
>context : any
|
||||
>bad : any
|
||||
|
||||
return <div></div>;
|
||||
><div></div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
}
|
||||
function MyComp2(props: MyProps, context: any) {
|
||||
>MyComp2 : (props: MyProps, context: any) => JSX.Element
|
||||
>props : MyProps
|
||||
>context : any
|
||||
|
||||
return <div></div>
|
||||
><div></div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
}
|
||||
|
||||
const a = <MyComp4 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
>a : JSX.Element
|
||||
><MyComp4 x={2}/> : JSX.Element
|
||||
>MyComp4 : (props: MyProps, context: any, bad: any, verybad: any) => JSX.Element
|
||||
>x : number
|
||||
>2 : 2
|
||||
|
||||
const b = <MyComp3 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
>b : JSX.Element
|
||||
><MyComp3 x={2}/> : JSX.Element
|
||||
>MyComp3 : (props: MyProps, context: any, bad: any) => JSX.Element
|
||||
>x : number
|
||||
>2 : 2
|
||||
|
||||
const c = <MyComp2 x={2}/>; // Should be OK, `context` is allowed, per react rules
|
||||
>c : JSX.Element
|
||||
><MyComp2 x={2}/> : JSX.Element
|
||||
>MyComp2 : (props: MyProps, context: any) => JSX.Element
|
||||
>x : number
|
||||
>2 : 2
|
||||
|
||||
declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element;
|
||||
>MyTagWithOptionalNonJSXBits : (props: MyProps, context: any, nonReactArg?: string) => JSX.Element
|
||||
>props : MyProps
|
||||
>context : any
|
||||
>nonReactArg : string
|
||||
>JSX : any
|
||||
|
||||
const d = <MyTagWithOptionalNonJSXBits x={2} />; // Technically OK, but probably questionable
|
||||
>d : JSX.Element
|
||||
><MyTagWithOptionalNonJSXBits x={2} /> : JSX.Element
|
||||
>MyTagWithOptionalNonJSXBits : (props: MyProps, context: any, nonReactArg?: string) => JSX.Element
|
||||
>x : number
|
||||
>2 : 2
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts(2,3): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts(5,7): error TS2741: Property '#field' is missing in type '{}' but required in type 'Class'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts (2 errors) ====
|
||||
export class Class {
|
||||
#field: any
|
||||
~~~~~~
|
||||
!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
}
|
||||
|
||||
const task: Class = {} as unknown;
|
||||
~~~~
|
||||
!!! error TS2741: Property '#field' is missing in type '{}' but required in type 'Class'.
|
||||
!!! related TS2728 tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts:2:3: '#field' is declared here.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [privateFieldAssignabilityFromUnknown.ts]
|
||||
export class Class {
|
||||
#field: any
|
||||
}
|
||||
|
||||
const task: Class = {} as unknown;
|
||||
|
||||
|
||||
//// [privateFieldAssignabilityFromUnknown.js]
|
||||
"use strict";
|
||||
var _field;
|
||||
exports.__esModule = true;
|
||||
var Class = /** @class */ (function () {
|
||||
function Class() {
|
||||
_field.set(this, void 0);
|
||||
}
|
||||
return Class;
|
||||
}());
|
||||
exports.Class = Class;
|
||||
_field = new WeakMap();
|
||||
var task = {};
|
||||
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts ===
|
||||
export class Class {
|
||||
>Class : Symbol(Class, Decl(privateFieldAssignabilityFromUnknown.ts, 0, 0))
|
||||
|
||||
#field: any
|
||||
>#field : Symbol(Class.#field, Decl(privateFieldAssignabilityFromUnknown.ts, 0, 20))
|
||||
}
|
||||
|
||||
const task: Class = {} as unknown;
|
||||
>task : Symbol(task, Decl(privateFieldAssignabilityFromUnknown.ts, 4, 5))
|
||||
>Class : Symbol(Class, Decl(privateFieldAssignabilityFromUnknown.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts ===
|
||||
export class Class {
|
||||
>Class : Class
|
||||
|
||||
#field: any
|
||||
>#field : any
|
||||
}
|
||||
|
||||
const task: Class = {} as unknown;
|
||||
>task : Class
|
||||
>{} as unknown : unknown
|
||||
>{} : {}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
tests/cases/compiler/tryCatchFinallyControlFlow.ts(105,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/tryCatchFinallyControlFlow.ts(118,9): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/tryCatchFinallyControlFlow.ts(218,13): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/tryCatchFinallyControlFlow.ts(220,9): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/tryCatchFinallyControlFlow.ts(255,9): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/tryCatchFinallyControlFlow.ts (1 errors) ====
|
||||
==== tests/cases/compiler/tryCatchFinallyControlFlow.ts (5 errors) ====
|
||||
// Repro from #34797
|
||||
|
||||
function f1() {
|
||||
@@ -111,6 +115,131 @@ tests/cases/compiler/tryCatchFinallyControlFlow.ts(105,5): error TS7027: Unreach
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
|
||||
function f8() {
|
||||
let x: 0 | 1 = 0;
|
||||
(() => {
|
||||
try {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
}
|
||||
x; // Unreachable
|
||||
~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
})();
|
||||
x; // 1
|
||||
}
|
||||
|
||||
function f9() {
|
||||
let x: 0 | 1 | 2 = 0;
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
}
|
||||
x; // 0
|
||||
x = 2;
|
||||
})();
|
||||
x; // 1 | 2
|
||||
}
|
||||
|
||||
function f10() {
|
||||
let x: 0 | 1 | 2 | 3 = 0;
|
||||
(() => {
|
||||
try {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
x = 2;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2
|
||||
}
|
||||
x; // 2
|
||||
x = 3;
|
||||
})();
|
||||
x; // 1 | 3
|
||||
}
|
||||
|
||||
function f11() {
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 = 0;
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
x; // 0 | 1 | 2
|
||||
x = 3;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
}
|
||||
}
|
||||
x; // 0 | 3 | 4
|
||||
x = 5;
|
||||
})();
|
||||
x; // 1 | 4 | 5
|
||||
}
|
||||
|
||||
function f12() {
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0;
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
x; // 0 | 1 | 2
|
||||
x = 3;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 5;
|
||||
return;
|
||||
}
|
||||
x = 6;
|
||||
return;
|
||||
x; // unreachable
|
||||
~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
x; // unreachable
|
||||
~~~~~~~~~~~~~~~~~
|
||||
x = 7; // no effect
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
})();
|
||||
x; // 4 | 5 | 6
|
||||
}
|
||||
|
||||
// Repro from #35644
|
||||
|
||||
const main = () => {
|
||||
@@ -129,4 +258,21 @@ tests/cases/compiler/tryCatchFinallyControlFlow.ts(105,5): error TS7027: Unreach
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #36828
|
||||
|
||||
function t1() {
|
||||
const x = (() => {
|
||||
try {
|
||||
return 'x';
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
x; // Unreachable
|
||||
~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
})();
|
||||
x; // Reachable
|
||||
}
|
||||
|
||||
@@ -106,6 +106,124 @@ function f7() {
|
||||
x; // Unreachable
|
||||
}
|
||||
|
||||
function f8() {
|
||||
let x: 0 | 1 = 0;
|
||||
(() => {
|
||||
try {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
}
|
||||
x; // Unreachable
|
||||
})();
|
||||
x; // 1
|
||||
}
|
||||
|
||||
function f9() {
|
||||
let x: 0 | 1 | 2 = 0;
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
}
|
||||
x; // 0
|
||||
x = 2;
|
||||
})();
|
||||
x; // 1 | 2
|
||||
}
|
||||
|
||||
function f10() {
|
||||
let x: 0 | 1 | 2 | 3 = 0;
|
||||
(() => {
|
||||
try {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
x = 2;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2
|
||||
}
|
||||
x; // 2
|
||||
x = 3;
|
||||
})();
|
||||
x; // 1 | 3
|
||||
}
|
||||
|
||||
function f11() {
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 = 0;
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
x; // 0 | 1 | 2
|
||||
x = 3;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
}
|
||||
}
|
||||
x; // 0 | 3 | 4
|
||||
x = 5;
|
||||
})();
|
||||
x; // 1 | 4 | 5
|
||||
}
|
||||
|
||||
function f12() {
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0;
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
x; // 0 | 1 | 2
|
||||
x = 3;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 5;
|
||||
return;
|
||||
}
|
||||
x = 6;
|
||||
return;
|
||||
x; // unreachable
|
||||
}
|
||||
x; // unreachable
|
||||
x = 7; // no effect
|
||||
})();
|
||||
x; // 4 | 5 | 6
|
||||
}
|
||||
|
||||
// Repro from #35644
|
||||
|
||||
const main = () => {
|
||||
@@ -124,6 +242,21 @@ const main = () => {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #36828
|
||||
|
||||
function t1() {
|
||||
const x = (() => {
|
||||
try {
|
||||
return 'x';
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
x; // Unreachable
|
||||
})();
|
||||
x; // Reachable
|
||||
}
|
||||
|
||||
|
||||
//// [tryCatchFinallyControlFlow.js]
|
||||
@@ -227,6 +360,119 @@ function f7() {
|
||||
}
|
||||
x; // Unreachable
|
||||
}
|
||||
function f8() {
|
||||
var x = 0;
|
||||
(function () {
|
||||
try {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
}
|
||||
x; // Unreachable
|
||||
})();
|
||||
x; // 1
|
||||
}
|
||||
function f9() {
|
||||
var x = 0;
|
||||
(function () {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
}
|
||||
x; // 0
|
||||
x = 2;
|
||||
})();
|
||||
x; // 1 | 2
|
||||
}
|
||||
function f10() {
|
||||
var x = 0;
|
||||
(function () {
|
||||
try {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
x = 2;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2
|
||||
}
|
||||
x; // 2
|
||||
x = 3;
|
||||
})();
|
||||
x; // 1 | 3
|
||||
}
|
||||
function f11() {
|
||||
var x = 0;
|
||||
(function () {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
x; // 0 | 1 | 2
|
||||
x = 3;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
}
|
||||
}
|
||||
x; // 0 | 3 | 4
|
||||
x = 5;
|
||||
})();
|
||||
x; // 1 | 4 | 5
|
||||
}
|
||||
function f12() {
|
||||
var x = 0;
|
||||
(function () {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
x; // 0 | 1 | 2
|
||||
x = 3;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 5;
|
||||
return;
|
||||
}
|
||||
x = 6;
|
||||
return;
|
||||
x; // unreachable
|
||||
}
|
||||
x; // unreachable
|
||||
x = 7; // no effect
|
||||
})();
|
||||
x; // 4 | 5 | 6
|
||||
}
|
||||
// Repro from #35644
|
||||
var main = function () {
|
||||
var hoge = undefined;
|
||||
@@ -244,3 +490,16 @@ var main = function () {
|
||||
return;
|
||||
}
|
||||
};
|
||||
// Repro from #36828
|
||||
function t1() {
|
||||
var x = (function () {
|
||||
try {
|
||||
return 'x';
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
x; // Unreachable
|
||||
})();
|
||||
x; // Reachable
|
||||
}
|
||||
|
||||
@@ -187,18 +187,221 @@ function f7() {
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 92, 7))
|
||||
}
|
||||
|
||||
function f8() {
|
||||
>f8 : Symbol(f8, Decl(tryCatchFinallyControlFlow.ts, 105, 1))
|
||||
|
||||
let x: 0 | 1 = 0;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7))
|
||||
|
||||
(() => {
|
||||
try {
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7))
|
||||
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7))
|
||||
}
|
||||
x; // Unreachable
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7))
|
||||
|
||||
})();
|
||||
x; // 1
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7))
|
||||
}
|
||||
|
||||
function f9() {
|
||||
>f9 : Symbol(f9, Decl(tryCatchFinallyControlFlow.ts, 120, 1))
|
||||
|
||||
let x: 0 | 1 | 2 = 0;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7))
|
||||
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7))
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7))
|
||||
}
|
||||
x; // 0
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7))
|
||||
|
||||
x = 2;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7))
|
||||
|
||||
})();
|
||||
x; // 1 | 2
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7))
|
||||
}
|
||||
|
||||
function f10() {
|
||||
>f10 : Symbol(f10, Decl(tryCatchFinallyControlFlow.ts, 138, 1))
|
||||
|
||||
let x: 0 | 1 | 2 | 3 = 0;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7))
|
||||
|
||||
(() => {
|
||||
try {
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7))
|
||||
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 147, 15))
|
||||
|
||||
x = 2;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7))
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7))
|
||||
}
|
||||
x; // 2
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7))
|
||||
|
||||
x = 3;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7))
|
||||
|
||||
})();
|
||||
x; // 1 | 3
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7))
|
||||
}
|
||||
|
||||
function f11() {
|
||||
>f11 : Symbol(f11, Decl(tryCatchFinallyControlFlow.ts, 157, 1))
|
||||
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 = 0;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 172, 15))
|
||||
|
||||
x; // 0 | 1 | 2
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
|
||||
x = 3;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
}
|
||||
}
|
||||
x; // 0 | 3 | 4
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
|
||||
x = 5;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
|
||||
})();
|
||||
x; // 1 | 4 | 5
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7))
|
||||
}
|
||||
|
||||
function f12() {
|
||||
>f12 : Symbol(f12, Decl(tryCatchFinallyControlFlow.ts, 186, 1))
|
||||
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 201, 15))
|
||||
|
||||
x; // 0 | 1 | 2
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
x = 3;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 5;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
return;
|
||||
}
|
||||
x = 6;
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
return;
|
||||
x; // unreachable
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
}
|
||||
x; // unreachable
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
x = 7; // no effect
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
|
||||
})();
|
||||
x; // 4 | 5 | 6
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7))
|
||||
}
|
||||
|
||||
// Repro from #35644
|
||||
|
||||
const main = () => {
|
||||
>main : Symbol(main, Decl(tryCatchFinallyControlFlow.ts, 109, 5))
|
||||
>main : Symbol(main, Decl(tryCatchFinallyControlFlow.ts, 227, 5))
|
||||
|
||||
let hoge: string | undefined = undefined;
|
||||
>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 110, 7))
|
||||
>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 228, 7))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
try {
|
||||
hoge = 'hoge!';
|
||||
>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 110, 7))
|
||||
>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 228, 7))
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -207,14 +410,38 @@ const main = () => {
|
||||
}
|
||||
finally {
|
||||
if (hoge) {
|
||||
>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 110, 7))
|
||||
>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 228, 7))
|
||||
|
||||
hoge.length;
|
||||
>hoge.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||||
>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 110, 7))
|
||||
>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 228, 7))
|
||||
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #36828
|
||||
|
||||
function t1() {
|
||||
>t1 : Symbol(t1, Decl(tryCatchFinallyControlFlow.ts, 242, 1))
|
||||
|
||||
const x = (() => {
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 247, 9))
|
||||
|
||||
try {
|
||||
return 'x';
|
||||
}
|
||||
catch (e) {
|
||||
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 251, 15))
|
||||
|
||||
return null;
|
||||
}
|
||||
x; // Unreachable
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 247, 9))
|
||||
|
||||
})();
|
||||
x; // Reachable
|
||||
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 247, 9))
|
||||
}
|
||||
|
||||
|
||||
@@ -228,6 +228,304 @@ function f7() {
|
||||
>x : 0 | 1 | 2 | 3
|
||||
}
|
||||
|
||||
function f8() {
|
||||
>f8 : () => void
|
||||
|
||||
let x: 0 | 1 = 0;
|
||||
>x : 0 | 1
|
||||
>0 : 0
|
||||
|
||||
(() => {
|
||||
>(() => { try { x = 1; return; } finally { x; // 0 | 1 } x; // Unreachable })() : void
|
||||
>(() => { try { x = 1; return; } finally { x; // 0 | 1 } x; // Unreachable }) : () => void
|
||||
>() => { try { x = 1; return; } finally { x; // 0 | 1 } x; // Unreachable } : () => void
|
||||
|
||||
try {
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : 0 | 1
|
||||
>1 : 1
|
||||
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
>x : 0 | 1
|
||||
}
|
||||
x; // Unreachable
|
||||
>x : 0 | 1
|
||||
|
||||
})();
|
||||
x; // 1
|
||||
>x : 1
|
||||
}
|
||||
|
||||
function f9() {
|
||||
>f9 : () => void
|
||||
|
||||
let x: 0 | 1 | 2 = 0;
|
||||
>x : 0 | 1 | 2
|
||||
>0 : 0
|
||||
|
||||
(() => {
|
||||
>(() => { try { if (!!true) { x = 1; return; } } finally { x; // 0 | 1 } x; // 0 x = 2; })() : void
|
||||
>(() => { try { if (!!true) { x = 1; return; } } finally { x; // 0 | 1 } x; // 0 x = 2; }) : () => void
|
||||
>() => { try { if (!!true) { x = 1; return; } } finally { x; // 0 | 1 } x; // 0 x = 2; } : () => void
|
||||
|
||||
try {
|
||||
if (!!true) {
|
||||
>!!true : true
|
||||
>!true : false
|
||||
>true : true
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : 0 | 1 | 2
|
||||
>1 : 1
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
>x : 0 | 1
|
||||
}
|
||||
x; // 0
|
||||
>x : 0
|
||||
|
||||
x = 2;
|
||||
>x = 2 : 2
|
||||
>x : 0 | 1 | 2
|
||||
>2 : 2
|
||||
|
||||
})();
|
||||
x; // 1 | 2
|
||||
>x : 1 | 2
|
||||
}
|
||||
|
||||
function f10() {
|
||||
>f10 : () => void
|
||||
|
||||
let x: 0 | 1 | 2 | 3 = 0;
|
||||
>x : 0 | 1 | 2 | 3
|
||||
>0 : 0
|
||||
|
||||
(() => {
|
||||
>(() => { try { x = 1; return; } catch (e) { x = 2; } finally { x; // 0 | 1 | 2 } x; // 2 x = 3; })() : void
|
||||
>(() => { try { x = 1; return; } catch (e) { x = 2; } finally { x; // 0 | 1 | 2 } x; // 2 x = 3; }) : () => void
|
||||
>() => { try { x = 1; return; } catch (e) { x = 2; } finally { x; // 0 | 1 | 2 } x; // 2 x = 3; } : () => void
|
||||
|
||||
try {
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : 0 | 1 | 2 | 3
|
||||
>1 : 1
|
||||
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
>e : any
|
||||
|
||||
x = 2;
|
||||
>x = 2 : 2
|
||||
>x : 0 | 1 | 2 | 3
|
||||
>2 : 2
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2
|
||||
>x : 0 | 1 | 2
|
||||
}
|
||||
x; // 2
|
||||
>x : 2
|
||||
|
||||
x = 3;
|
||||
>x = 3 : 3
|
||||
>x : 0 | 1 | 2 | 3
|
||||
>3 : 3
|
||||
|
||||
})();
|
||||
x; // 1 | 3
|
||||
>x : 1 | 3
|
||||
}
|
||||
|
||||
function f11() {
|
||||
>f11 : () => void
|
||||
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 = 0;
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5
|
||||
>0 : 0
|
||||
|
||||
(() => {
|
||||
>(() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; } } x; // 0 | 3 | 4 x = 5; })() : void
|
||||
>(() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; } } x; // 0 | 3 | 4 x = 5; }) : () => void
|
||||
>() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; } } x; // 0 | 3 | 4 x = 5; } : () => void
|
||||
|
||||
try {
|
||||
if (!!true) {
|
||||
>!!true : true
|
||||
>!true : false
|
||||
>true : true
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5
|
||||
>1 : 1
|
||||
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
>!!true : true
|
||||
>!true : false
|
||||
>true : true
|
||||
|
||||
x = 2;
|
||||
>x = 2 : 2
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5
|
||||
>2 : 2
|
||||
|
||||
throw 0;
|
||||
>0 : 0
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
>e : any
|
||||
|
||||
x; // 0 | 1 | 2
|
||||
>x : 0 | 1 | 2
|
||||
|
||||
x = 3;
|
||||
>x = 3 : 3
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5
|
||||
>3 : 3
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
>x : 0 | 1 | 2 | 3
|
||||
|
||||
if (!!true) {
|
||||
>!!true : true
|
||||
>!true : false
|
||||
>true : true
|
||||
|
||||
x = 4;
|
||||
>x = 4 : 4
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5
|
||||
>4 : 4
|
||||
}
|
||||
}
|
||||
x; // 0 | 3 | 4
|
||||
>x : 0 | 3 | 4
|
||||
|
||||
x = 5;
|
||||
>x = 5 : 5
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5
|
||||
>5 : 5
|
||||
|
||||
})();
|
||||
x; // 1 | 4 | 5
|
||||
>x : 1 | 4 | 5
|
||||
}
|
||||
|
||||
function f12() {
|
||||
>f12 : () => void
|
||||
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0;
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
>0 : 0
|
||||
|
||||
(() => {
|
||||
>(() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; return; } if (!!true) { x = 5; return; } x = 6; return; x; // unreachable } x; // unreachable x = 7; // no effect })() : void
|
||||
>(() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; return; } if (!!true) { x = 5; return; } x = 6; return; x; // unreachable } x; // unreachable x = 7; // no effect }) : () => void
|
||||
>() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; return; } if (!!true) { x = 5; return; } x = 6; return; x; // unreachable } x; // unreachable x = 7; // no effect } : () => void
|
||||
|
||||
try {
|
||||
if (!!true) {
|
||||
>!!true : true
|
||||
>!true : false
|
||||
>true : true
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
>1 : 1
|
||||
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
>!!true : true
|
||||
>!true : false
|
||||
>true : true
|
||||
|
||||
x = 2;
|
||||
>x = 2 : 2
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
>2 : 2
|
||||
|
||||
throw 0;
|
||||
>0 : 0
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
>e : any
|
||||
|
||||
x; // 0 | 1 | 2
|
||||
>x : 0 | 1 | 2
|
||||
|
||||
x = 3;
|
||||
>x = 3 : 3
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
>3 : 3
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
>x : 0 | 1 | 2 | 3
|
||||
|
||||
if (!!true) {
|
||||
>!!true : true
|
||||
>!true : false
|
||||
>true : true
|
||||
|
||||
x = 4;
|
||||
>x = 4 : 4
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
>4 : 4
|
||||
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
>!!true : true
|
||||
>!true : false
|
||||
>true : true
|
||||
|
||||
x = 5;
|
||||
>x = 5 : 5
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
>5 : 5
|
||||
|
||||
return;
|
||||
}
|
||||
x = 6;
|
||||
>x = 6 : 6
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
>6 : 6
|
||||
|
||||
return;
|
||||
x; // unreachable
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
}
|
||||
x; // unreachable
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
|
||||
x = 7; // no effect
|
||||
>x = 7 : 7
|
||||
>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
||||
>7 : 7
|
||||
|
||||
})();
|
||||
x; // 4 | 5 | 6
|
||||
>x : 4 | 5 | 6
|
||||
}
|
||||
|
||||
// Repro from #35644
|
||||
|
||||
const main = () => {
|
||||
@@ -262,3 +560,32 @@ const main = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #36828
|
||||
|
||||
function t1() {
|
||||
>t1 : () => void
|
||||
|
||||
const x = (() => {
|
||||
>x : "x" | null
|
||||
>(() => { try { return 'x'; } catch (e) { return null; } x; // Unreachable })() : "x" | null
|
||||
>(() => { try { return 'x'; } catch (e) { return null; } x; // Unreachable }) : () => "x" | null
|
||||
>() => { try { return 'x'; } catch (e) { return null; } x; // Unreachable } : () => "x" | null
|
||||
|
||||
try {
|
||||
return 'x';
|
||||
>'x' : "x"
|
||||
}
|
||||
catch (e) {
|
||||
>e : any
|
||||
|
||||
return null;
|
||||
>null : null
|
||||
}
|
||||
x; // Unreachable
|
||||
>x : "x" | null
|
||||
|
||||
})();
|
||||
x; // Reachable
|
||||
>x : "x" | null
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [tsxUnionMemberChecksFilterDataProps.tsx]
|
||||
/// <reference path="/.lib/react16.d.ts" />
|
||||
import React, { ReactElement } from "react";
|
||||
|
||||
declare function NotHappy(props: ({ fixed?: boolean } | { value?: number })): ReactElement<any>;
|
||||
declare function Happy(props: { fixed?: boolean, value?: number }): ReactElement<any>;
|
||||
|
||||
const RootNotHappy = () => (<NotHappy data-testid="my-test-id" />);
|
||||
const RootHappy = () => (<Happy data-testid="my-test-id" />);
|
||||
|
||||
|
||||
//// [tsxUnionMemberChecksFilterDataProps.js]
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
exports.__esModule = true;
|
||||
/// <reference path="react16.d.ts" />
|
||||
var react_1 = __importDefault(require("react"));
|
||||
var RootNotHappy = function () { return (react_1["default"].createElement(NotHappy, { "data-testid": "my-test-id" })); };
|
||||
var RootHappy = function () { return (react_1["default"].createElement(Happy, { "data-testid": "my-test-id" })); };
|
||||
@@ -0,0 +1,30 @@
|
||||
=== tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx ===
|
||||
/// <reference path="react16.d.ts" />
|
||||
import React, { ReactElement } from "react";
|
||||
>React : Symbol(React, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 6))
|
||||
>ReactElement : Symbol(ReactElement, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 15))
|
||||
|
||||
declare function NotHappy(props: ({ fixed?: boolean } | { value?: number })): ReactElement<any>;
|
||||
>NotHappy : Symbol(NotHappy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 44))
|
||||
>props : Symbol(props, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 26))
|
||||
>fixed : Symbol(fixed, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 35))
|
||||
>value : Symbol(value, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 57))
|
||||
>ReactElement : Symbol(ReactElement, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 15))
|
||||
|
||||
declare function Happy(props: { fixed?: boolean, value?: number }): ReactElement<any>;
|
||||
>Happy : Symbol(Happy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 96))
|
||||
>props : Symbol(props, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 4, 23))
|
||||
>fixed : Symbol(fixed, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 4, 31))
|
||||
>value : Symbol(value, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 4, 48))
|
||||
>ReactElement : Symbol(ReactElement, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 15))
|
||||
|
||||
const RootNotHappy = () => (<NotHappy data-testid="my-test-id" />);
|
||||
>RootNotHappy : Symbol(RootNotHappy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 6, 5))
|
||||
>NotHappy : Symbol(NotHappy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 44))
|
||||
>data-testid : Symbol(data-testid, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 6, 37))
|
||||
|
||||
const RootHappy = () => (<Happy data-testid="my-test-id" />);
|
||||
>RootHappy : Symbol(RootHappy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 7, 5))
|
||||
>Happy : Symbol(Happy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 96))
|
||||
>data-testid : Symbol(data-testid, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 7, 31))
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
=== tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx ===
|
||||
/// <reference path="react16.d.ts" />
|
||||
import React, { ReactElement } from "react";
|
||||
>React : typeof React
|
||||
>ReactElement : any
|
||||
|
||||
declare function NotHappy(props: ({ fixed?: boolean } | { value?: number })): ReactElement<any>;
|
||||
>NotHappy : (props: { fixed?: boolean; } | { value?: number; }) => React.ReactElement<any>
|
||||
>props : { fixed?: boolean; } | { value?: number; }
|
||||
>fixed : boolean
|
||||
>value : number
|
||||
|
||||
declare function Happy(props: { fixed?: boolean, value?: number }): ReactElement<any>;
|
||||
>Happy : (props: { fixed?: boolean; value?: number; }) => React.ReactElement<any>
|
||||
>props : { fixed?: boolean; value?: number; }
|
||||
>fixed : boolean
|
||||
>value : number
|
||||
|
||||
const RootNotHappy = () => (<NotHappy data-testid="my-test-id" />);
|
||||
>RootNotHappy : () => JSX.Element
|
||||
>() => (<NotHappy data-testid="my-test-id" />) : () => JSX.Element
|
||||
>(<NotHappy data-testid="my-test-id" />) : JSX.Element
|
||||
><NotHappy data-testid="my-test-id" /> : JSX.Element
|
||||
>NotHappy : (props: { fixed?: boolean; } | { value?: number; }) => React.ReactElement<any>
|
||||
>data-testid : string
|
||||
|
||||
const RootHappy = () => (<Happy data-testid="my-test-id" />);
|
||||
>RootHappy : () => JSX.Element
|
||||
>() => (<Happy data-testid="my-test-id" />) : () => JSX.Element
|
||||
>(<Happy data-testid="my-test-id" />) : JSX.Element
|
||||
><Happy data-testid="my-test-id" /> : JSX.Element
|
||||
>Happy : (props: { fixed?: boolean; value?: number; }) => React.ReactElement<any>
|
||||
>data-testid : string
|
||||
|
||||
@@ -12,7 +12,7 @@ node_modules/chrome-devtools-frontend/front_end/Runtime.js(270,9): error TS2322:
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(280,5): error TS2322: Type 'Promise<void>' is not assignable to type 'Promise<undefined>'.
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(283,12): error TS2554: Expected 2-3 arguments, but got 1.
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(525,9): error TS2322: Type 'Window' is not assignable to type 'Window & typeof globalThis'.
|
||||
Type 'Window' is missing the following properties from type 'typeof globalThis': globalThis, eval, parseInt, parseFloat, and 872 more.
|
||||
Type 'Window' is missing the following properties from type 'typeof globalThis': globalThis, eval, parseInt, parseFloat, and 871 more.
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(527,49): error TS2352: Conversion of type 'Window & typeof globalThis' to type 'new () => any' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
Type 'Window & typeof globalThis' provides no match for the signature 'new (): any'.
|
||||
node_modules/chrome-devtools-frontend/front_end/Runtime.js(539,24): error TS2351: This expression is not constructable.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,22 @@
|
||||
type AnyFunction = (...args: any[]) => any;
|
||||
type Params<T> = Parameters<Extract<T, AnyFunction>>;
|
||||
|
||||
interface Wrapper<T> {
|
||||
call<K extends keyof T>(event: K, ...args: Params<T[K]>): void;
|
||||
}
|
||||
|
||||
interface AWrapped {
|
||||
foo(): void;
|
||||
}
|
||||
|
||||
class A {
|
||||
foo: Wrapper<AWrapped>;
|
||||
}
|
||||
|
||||
interface BWrapped extends AWrapped {
|
||||
bar(): void;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
foo: Wrapper<BWrapped>;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// @jsx: react
|
||||
/// <reference path="/.lib/react16.d.ts" />
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
interface MyProps {
|
||||
x: number;
|
||||
}
|
||||
|
||||
function MyComp4(props: MyProps, context: any, bad: any, verybad: any) {
|
||||
return <div></div>;
|
||||
}
|
||||
function MyComp3(props: MyProps, context: any, bad: any) {
|
||||
return <div></div>;
|
||||
}
|
||||
function MyComp2(props: MyProps, context: any) {
|
||||
return <div></div>
|
||||
}
|
||||
|
||||
const a = <MyComp4 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
const b = <MyComp3 x={2}/>; // using `MyComp` as a component should error - it expects more arguments than react provides
|
||||
const c = <MyComp2 x={2}/>; // Should be OK, `context` is allowed, per react rules
|
||||
|
||||
declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element;
|
||||
const d = <MyTagWithOptionalNonJSXBits x={2} />; // Technically OK, but probably questionable
|
||||
@@ -0,0 +1,5 @@
|
||||
export class Class {
|
||||
#field: any
|
||||
}
|
||||
|
||||
const task: Class = {} as unknown;
|
||||
@@ -108,6 +108,124 @@ function f7() {
|
||||
x; // Unreachable
|
||||
}
|
||||
|
||||
function f8() {
|
||||
let x: 0 | 1 = 0;
|
||||
(() => {
|
||||
try {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
}
|
||||
x; // Unreachable
|
||||
})();
|
||||
x; // 1
|
||||
}
|
||||
|
||||
function f9() {
|
||||
let x: 0 | 1 | 2 = 0;
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1
|
||||
}
|
||||
x; // 0
|
||||
x = 2;
|
||||
})();
|
||||
x; // 1 | 2
|
||||
}
|
||||
|
||||
function f10() {
|
||||
let x: 0 | 1 | 2 | 3 = 0;
|
||||
(() => {
|
||||
try {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
x = 2;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2
|
||||
}
|
||||
x; // 2
|
||||
x = 3;
|
||||
})();
|
||||
x; // 1 | 3
|
||||
}
|
||||
|
||||
function f11() {
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 = 0;
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
x; // 0 | 1 | 2
|
||||
x = 3;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
}
|
||||
}
|
||||
x; // 0 | 3 | 4
|
||||
x = 5;
|
||||
})();
|
||||
x; // 1 | 4 | 5
|
||||
}
|
||||
|
||||
function f12() {
|
||||
let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0;
|
||||
(() => {
|
||||
try {
|
||||
if (!!true) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 2;
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
x; // 0 | 1 | 2
|
||||
x = 3;
|
||||
}
|
||||
finally {
|
||||
x; // 0 | 1 | 2 | 3
|
||||
if (!!true) {
|
||||
x = 4;
|
||||
return;
|
||||
}
|
||||
if (!!true) {
|
||||
x = 5;
|
||||
return;
|
||||
}
|
||||
x = 6;
|
||||
return;
|
||||
x; // unreachable
|
||||
}
|
||||
x; // unreachable
|
||||
x = 7; // no effect
|
||||
})();
|
||||
x; // 4 | 5 | 6
|
||||
}
|
||||
|
||||
// Repro from #35644
|
||||
|
||||
const main = () => {
|
||||
@@ -126,3 +244,18 @@ const main = () => {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #36828
|
||||
|
||||
function t1() {
|
||||
const x = (() => {
|
||||
try {
|
||||
return 'x';
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
x; // Unreachable
|
||||
})();
|
||||
x; // Reachable
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// @jsx: react
|
||||
// @esModuleInterop: true
|
||||
/// <reference path="/.lib/react16.d.ts" />
|
||||
import React, { ReactElement } from "react";
|
||||
|
||||
declare function NotHappy(props: ({ fixed?: boolean } | { value?: number })): ReactElement<any>;
|
||||
declare function Happy(props: { fixed?: boolean, value?: number }): ReactElement<any>;
|
||||
|
||||
const RootNotHappy = () => (<NotHappy data-testid="my-test-id" />);
|
||||
const RootHappy = () => (<Happy data-testid="my-test-id" />);
|
||||
@@ -19,4 +19,4 @@ RUN yarn add typescript@../../typescript.tgz --exact --ignore-scripts
|
||||
WORKDIR /office-ui-fabric-react
|
||||
RUN yarn
|
||||
ENTRYPOINT [ "lerna" ]
|
||||
CMD [ "run", "build", "--stream", "--concurrency", "1", "--", "--production", "--lint" ]
|
||||
CMD [ "run", "build", "--stream", "--concurrency", "1", "--loglevel", "error", "--", "--production", "--lint", "--silent" ]
|
||||
@@ -0,0 +1,37 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var a = { name: 'bob', age: 18 };
|
||||
////var b = { name: 'jim', age: 20 };
|
||||
////var /*1*/c = [a, b];
|
||||
|
||||
////var a1 = { name: 'bob', age: 18 };
|
||||
////var b1 = { name: 'jim', age: 20, dob: new Date() };
|
||||
////var /*2*/c1 = [a1, b1];
|
||||
|
||||
////var a2 = { name: 'bob', age: 18, address: 'springfield' };
|
||||
////var b2 = { name: 'jim', age: 20, dob: new Date() };
|
||||
////var /*3*/c2 = [a2, b2];
|
||||
|
||||
////interface I {
|
||||
//// name: string;
|
||||
//// age: number;
|
||||
////}
|
||||
|
||||
////var i: I;
|
||||
////var /*4*/c3 = [i, a];
|
||||
|
||||
verify.quickInfos({
|
||||
1: "var c: {\n name: string;\n age: number;\n}[]",
|
||||
2: "var c1: {\n name: string;\n age: number;\n}[]",
|
||||
3:
|
||||
`var c2: ({
|
||||
name: string;
|
||||
age: number;
|
||||
address: string;
|
||||
} | {
|
||||
name: string;
|
||||
age: number;
|
||||
dob: Date;
|
||||
})[]`,
|
||||
4: "var c3: {\n name: string;\n age: number;\n}[]"
|
||||
});
|
||||
@@ -20,6 +20,9 @@
|
||||
////var i: I;
|
||||
////var /*4*/c3 = [i, a];
|
||||
|
||||
verify.quickInfos({
|
||||
4: "var c3: I[]"
|
||||
});
|
||||
verify.quickInfos({
|
||||
1: "var c: {\n name: string;\n age: number;\n}[]",
|
||||
2: "var c1: {\n name: string;\n age: number;\n}[]",
|
||||
|
||||
@@ -18,6 +18,11 @@ verify.noErrors();
|
||||
// TODO: GH#24025
|
||||
|
||||
const [rModuleDef, rModule, r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4, r5] = test.ranges();
|
||||
verify.referenceGroups([r3, r4], [
|
||||
{ definition: 'module "/a"', ranges: [r4, rModule] },
|
||||
{ definition: "(local class) C", ranges: [r0] },
|
||||
{ definition: "(alias) (local class) export=\nimport export=", ranges: [r3] },
|
||||
]);
|
||||
verify.referenceGroups(rModule, [{ definition: 'module "/a"', ranges: [r3, r4, rModule] }]);
|
||||
verify.referenceGroups(r0, [
|
||||
{ definition: "(local class) C", ranges: [r0] },
|
||||
@@ -33,6 +38,6 @@ verify.referenceGroups(r2, [
|
||||
]);
|
||||
verify.referenceGroups([r3, r4], [
|
||||
{ definition: 'module "/a"', ranges: [r4, rModule] },
|
||||
{ definition: "(local class) C", ranges: [r0] },
|
||||
{ definition: "(alias) (local class) export=\nimport export=", ranges: [r3] },
|
||||
//{ definition: "(local class) C", ranges: [r0] },
|
||||
//{ definition: "(alias) (local class) export=\nimport export=", ranges: [r3] },
|
||||
]);
|
||||
|
||||
@@ -317,7 +317,7 @@ declare namespace FourSlashInterface {
|
||||
baselineQuickInfo(): void;
|
||||
baselineSmartSelection(): void;
|
||||
nameOrDottedNameSpanTextIs(text: string): void;
|
||||
outliningSpansInCurrentFile(spans: Range[]): void;
|
||||
outliningSpansInCurrentFile(spans: Range[], kind?: "comment" | "region" | "code" | "imports"): void;
|
||||
outliningHintSpansInCurrentFile(spans: Range[]): void;
|
||||
todoCommentsInCurrentFile(descriptors: string[]): void;
|
||||
matchingBracePositionInCurrentFile(bracePosition: number, expectedMatchPosition: number): void;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
// #22732
|
||||
|
||||
////[|/*
|
||||
///// * Some text
|
||||
//// */|]
|
||||
|
||||
verify.outliningHintSpansInCurrentFile(test.ranges());
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
// #22732
|
||||
|
||||
////console.log(0);
|
||||
////[|/*
|
||||
///// * Some text
|
||||
//// */|]
|
||||
|
||||
verify.outliningHintSpansInCurrentFile(test.ranges());
|
||||
@@ -48,4 +48,4 @@
|
||||
////// #endregion
|
||||
////*/
|
||||
|
||||
verify.outliningSpansInCurrentFile(test.ranges(), "region");
|
||||
verify.outliningSpansInCurrentFile(test.ranges(), "region");
|
||||
Reference in New Issue
Block a user