-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tighten heuristic for definite dts moduleness to check for syntactic …
…default (#22814) * Tighten heuristic for definite dts moduleness to check for syntactic default exports * Inline function
- Loading branch information
Showing
5 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/baselines/reference/esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//// [tests/cases/compiler/esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.ts] //// | ||
|
||
//// [point.d.ts] | ||
declare class Point { | ||
x: number; | ||
y: number; | ||
|
||
constructor(x: number, y: number); | ||
|
||
static default: "foo"; | ||
} | ||
|
||
export = Point; | ||
//// [index.ts] | ||
import Point from "./point"; | ||
|
||
const C = Point; | ||
const p = new C(1, 2); | ||
|
||
|
||
//// [index.js] | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
exports.__esModule = true; | ||
var point_1 = __importDefault(require("./point")); | ||
var C = point_1["default"]; | ||
var p = new C(1, 2); |
33 changes: 33 additions & 0 deletions
33
.../baselines/reference/esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
=== tests/cases/compiler/point.d.ts === | ||
declare class Point { | ||
>Point : Symbol(Point, Decl(point.d.ts, 0, 0)) | ||
|
||
x: number; | ||
>x : Symbol(Point.x, Decl(point.d.ts, 0, 21)) | ||
|
||
y: number; | ||
>y : Symbol(Point.y, Decl(point.d.ts, 1, 14)) | ||
|
||
constructor(x: number, y: number); | ||
>x : Symbol(x, Decl(point.d.ts, 4, 16)) | ||
>y : Symbol(y, Decl(point.d.ts, 4, 26)) | ||
|
||
static default: "foo"; | ||
>default : Symbol(Point.default, Decl(point.d.ts, 4, 38)) | ||
} | ||
|
||
export = Point; | ||
>Point : Symbol(Point, Decl(point.d.ts, 0, 0)) | ||
|
||
=== tests/cases/compiler/index.ts === | ||
import Point from "./point"; | ||
>Point : Symbol(Point, Decl(index.ts, 0, 6)) | ||
|
||
const C = Point; | ||
>C : Symbol(C, Decl(index.ts, 2, 5)) | ||
>Point : Symbol(Point, Decl(index.ts, 0, 6)) | ||
|
||
const p = new C(1, 2); | ||
>p : Symbol(p, Decl(index.ts, 3, 5)) | ||
>C : Symbol(C, Decl(index.ts, 2, 5)) | ||
|
36 changes: 36 additions & 0 deletions
36
tests/baselines/reference/esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
=== tests/cases/compiler/point.d.ts === | ||
declare class Point { | ||
>Point : Point | ||
|
||
x: number; | ||
>x : number | ||
|
||
y: number; | ||
>y : number | ||
|
||
constructor(x: number, y: number); | ||
>x : number | ||
>y : number | ||
|
||
static default: "foo"; | ||
>default : "foo" | ||
} | ||
|
||
export = Point; | ||
>Point : Point | ||
|
||
=== tests/cases/compiler/index.ts === | ||
import Point from "./point"; | ||
>Point : typeof Point | ||
|
||
const C = Point; | ||
>C : typeof Point | ||
>Point : typeof Point | ||
|
||
const p = new C(1, 2); | ||
>p : Point | ||
>new C(1, 2) : Point | ||
>C : typeof Point | ||
>1 : 1 | ||
>2 : 2 | ||
|
17 changes: 17 additions & 0 deletions
17
tests/cases/compiler/esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// @esModuleInterop: true | ||
// @filename: point.d.ts | ||
declare class Point { | ||
x: number; | ||
y: number; | ||
|
||
constructor(x: number, y: number); | ||
|
||
static default: "foo"; | ||
} | ||
|
||
export = Point; | ||
// @filename: index.ts | ||
import Point from "./point"; | ||
|
||
const C = Point; | ||
const p = new C(1, 2); |