mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
This commit is contained in:
@@ -60,7 +60,7 @@ namespace ts {
|
||||
// import * as x from "mod"
|
||||
// import { x, y } from "mod"
|
||||
externalImports.push(<ImportDeclaration>node);
|
||||
hasImportStarOrImportDefault = getImportNeedsImportStarHelper(<ImportDeclaration>node) || getImportNeedsImportDefaultHelper(<ImportDeclaration>node);
|
||||
hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(<ImportDeclaration>node) || getImportNeedsImportDefaultHelper(<ImportDeclaration>node);
|
||||
break;
|
||||
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//// [tests/cases/compiler/esModuleInteropImportTSLibHasImport.ts] ////
|
||||
|
||||
//// [types.d.ts]
|
||||
declare module "tslib" { export const __exportStar: any; export const __importDefault: any; export const __importStar: any; }
|
||||
//// [username.ts]
|
||||
export const username = () => 'username';
|
||||
//// [index.ts]
|
||||
export * from './username';
|
||||
//// [hello.ts]
|
||||
const sayHello = (name?: string) => void (`Hello, ${name}!`);
|
||||
|
||||
export default sayHello;
|
||||
//// [index.ts]
|
||||
import sayHello from "./hello";
|
||||
import { username } from './utils';
|
||||
|
||||
sayHello(username());
|
||||
|
||||
//// [username.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.username = () => 'username';
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./username"), exports);
|
||||
//// [hello.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const sayHello = (name) => void (`Hello, ${name}!`);
|
||||
exports.default = sayHello;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const hello_1 = tslib_1.__importDefault(require("./hello"));
|
||||
const utils_1 = require("./utils");
|
||||
hello_1.default(utils_1.username());
|
||||
@@ -0,0 +1,33 @@
|
||||
=== tests/cases/compiler/types.d.ts ===
|
||||
declare module "tslib" { export const __exportStar: any; export const __importDefault: any; export const __importStar: any; }
|
||||
>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 0))
|
||||
>__exportStar : Symbol(__exportStar, Decl(types.d.ts, 0, 37))
|
||||
>__importDefault : Symbol(__importDefault, Decl(types.d.ts, 0, 69))
|
||||
>__importStar : Symbol(__importStar, Decl(types.d.ts, 0, 104))
|
||||
|
||||
=== tests/cases/compiler/utils/username.ts ===
|
||||
export const username = () => 'username';
|
||||
>username : Symbol(username, Decl(username.ts, 0, 12))
|
||||
|
||||
=== tests/cases/compiler/utils/index.ts ===
|
||||
export * from './username';
|
||||
No type information for this code.=== tests/cases/compiler/hello.ts ===
|
||||
const sayHello = (name?: string) => void (`Hello, ${name}!`);
|
||||
>sayHello : Symbol(sayHello, Decl(hello.ts, 0, 5))
|
||||
>name : Symbol(name, Decl(hello.ts, 0, 18))
|
||||
>name : Symbol(name, Decl(hello.ts, 0, 18))
|
||||
|
||||
export default sayHello;
|
||||
>sayHello : Symbol(sayHello, Decl(hello.ts, 0, 5))
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import sayHello from "./hello";
|
||||
>sayHello : Symbol(sayHello, Decl(index.ts, 0, 6))
|
||||
|
||||
import { username } from './utils';
|
||||
>username : Symbol(username, Decl(index.ts, 1, 8))
|
||||
|
||||
sayHello(username());
|
||||
>sayHello : Symbol(sayHello, Decl(index.ts, 0, 6))
|
||||
>username : Symbol(username, Decl(index.ts, 1, 8))
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
=== tests/cases/compiler/types.d.ts ===
|
||||
declare module "tslib" { export const __exportStar: any; export const __importDefault: any; export const __importStar: any; }
|
||||
>"tslib" : typeof "tslib"
|
||||
>__exportStar : any
|
||||
>__importDefault : any
|
||||
>__importStar : any
|
||||
|
||||
=== tests/cases/compiler/utils/username.ts ===
|
||||
export const username = () => 'username';
|
||||
>username : () => string
|
||||
>() => 'username' : () => string
|
||||
>'username' : "username"
|
||||
|
||||
=== tests/cases/compiler/utils/index.ts ===
|
||||
export * from './username';
|
||||
No type information for this code.=== tests/cases/compiler/hello.ts ===
|
||||
const sayHello = (name?: string) => void (`Hello, ${name}!`);
|
||||
>sayHello : (name?: string) => any
|
||||
>(name?: string) => void (`Hello, ${name}!`) : (name?: string) => any
|
||||
>name : string
|
||||
>void (`Hello, ${name}!`) : undefined
|
||||
>(`Hello, ${name}!`) : string
|
||||
>`Hello, ${name}!` : string
|
||||
>name : string
|
||||
|
||||
export default sayHello;
|
||||
>sayHello : (name?: string) => any
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import sayHello from "./hello";
|
||||
>sayHello : (name?: string) => any
|
||||
|
||||
import { username } from './utils';
|
||||
>username : () => string
|
||||
|
||||
sayHello(username());
|
||||
>sayHello(username()) : any
|
||||
>sayHello : (name?: string) => any
|
||||
>username() : string
|
||||
>username : () => string
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// @esModuleInterop: true
|
||||
// @importHelpers: true
|
||||
// @noEmitHelpers: true
|
||||
// @target: es2017
|
||||
// @module: commonjs
|
||||
// @filename: types.d.ts
|
||||
declare module "tslib" { export const __exportStar: any; export const __importDefault: any; export const __importStar: any; }
|
||||
// @filename: utils/username.ts
|
||||
export const username = () => 'username';
|
||||
// @filename: utils/index.ts
|
||||
export * from './username';
|
||||
// @filename: hello.ts
|
||||
const sayHello = (name?: string) => void (`Hello, ${name}!`);
|
||||
|
||||
export default sayHello;
|
||||
// @filename: index.ts
|
||||
import sayHello from "./hello";
|
||||
import { username } from './utils';
|
||||
|
||||
sayHello(username());
|
||||
Reference in New Issue
Block a user