Skip to content

Commit 8d41b63

Browse files
committed
Merge branch 'master' into alter-js-affordances-strategy
2 parents ce8bff9 + b895614 commit 8d41b63

File tree

3,783 files changed

+300
-55970
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,783 files changed

+300
-55970
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11255,8 +11255,8 @@ namespace ts {
1125511255
}
1125611256

1125711257
function hasExcessProperties(source: FreshObjectLiteralType, target: Type, discriminant: Type | undefined, reportErrors: boolean): boolean {
11258-
if (!noImplicitAny && getObjectFlags(source) & ObjectFlags.JSLiteral) {
11259-
return false; // DIsable excess property checks on JS literals to simulate having an implicit "index signature" - but only outside of noImplicitAny
11258+
if (!noImplicitAny && getObjectFlags(target) & ObjectFlags.JSLiteral) {
11259+
return false; // Disable excess property checks on JS literals to simulate having an implicit "index signature" - but only outside of noImplicitAny
1126011260
}
1126111261
if (maybeTypeOfKind(target, TypeFlags.Object) && !(getObjectFlags(target) & ObjectFlags.ObjectLiteralPatternWithComputedProperties)) {
1126211262
const isComparingJsxAttributes = !!(getObjectFlags(source) & ObjectFlags.JsxAttributes);

src/harness/typeWriter.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ class TypeWriterWalker {
7575
const sourceText = ts.getSourceTextOfNodeFromSourceFile(this.currentSourceFile, node);
7676

7777
if (!isSymbolWalk) {
78+
// Don't try to get the type of something that's already a type.
79+
// Exception for `T` in `type T = something` because that may evaluate to some interesting type.
80+
if (ts.isPartOfTypeNode(node) || ts.isIdentifier(node) && !(ts.getMeaningFromDeclaration(node.parent) & ts.SemanticMeaning.Value) && !(ts.isTypeAlias(node.parent) && node.parent.name === node)) {
81+
return undefined;
82+
}
83+
7884
// Workaround to ensure we output 'C' instead of 'typeof C' for base class expressions
7985
// let type = this.checker.getTypeAtLocation(node);
8086
const type = node.parent && ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent) && this.checker.getTypeAtLocation(node.parent) || this.checker.getTypeAtLocation(node);

0 commit comments

Comments
 (0)