mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Gabritto/jsemitfixsilly (#50849)
* delete unused test and refactor unneeded ternary * add parens
This commit is contained in:
parent
3014dec887
commit
67f2b62ed2
@ -2463,11 +2463,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function shouldEmitAliasDeclaration(node: Node): boolean {
|
||||
return isInJSFile(node)
|
||||
? true
|
||||
: compilerOptions.preserveValueImports
|
||||
return isInJSFile(node) ||
|
||||
(compilerOptions.preserveValueImports
|
||||
? resolver.isValueAliasDeclaration(node)
|
||||
: resolver.isReferencedAliasDeclaration(node);
|
||||
: resolver.isReferencedAliasDeclaration(node));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
//// [tests/cases/compiler/elidedJSImport2.ts] ////
|
||||
|
||||
//// [index.js]
|
||||
import { Foo } from "./other.js";
|
||||
import * as other from "./other.js";
|
||||
import defaultFoo from "./other.js";
|
||||
|
||||
const x = new Foo();
|
||||
const y = other.Foo();
|
||||
const z = new defaultFoo();
|
||||
|
||||
//// [other.d.ts]
|
||||
export interface Foo {
|
||||
bar: number;
|
||||
}
|
||||
|
||||
export default interface Bar {
|
||||
foo: number;
|
||||
}
|
||||
|
||||
//// [other.js]
|
||||
export class Foo {
|
||||
bar = 2.4;
|
||||
}
|
||||
|
||||
export default class Bar {
|
||||
foo = 1.2;
|
||||
}
|
||||
|
||||
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const other_js_1 = require("./other.js");
|
||||
const other = __importStar(require("./other.js"));
|
||||
const other_js_2 = __importDefault(require("./other.js"));
|
||||
const x = new other_js_1.Foo();
|
||||
const y = other.Foo();
|
||||
const z = new other_js_2.default();
|
||||
//// [other.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Foo = void 0;
|
||||
class Foo {
|
||||
bar = 2.4;
|
||||
}
|
||||
exports.Foo = Foo;
|
||||
class Bar {
|
||||
foo = 1.2;
|
||||
}
|
||||
exports.default = Bar;
|
||||
@ -1,50 +0,0 @@
|
||||
=== tests/cases/compiler/index.js ===
|
||||
import { Foo } from "./other.js";
|
||||
>Foo : Symbol(Foo, Decl(index.js, 0, 8))
|
||||
|
||||
import * as other from "./other.js";
|
||||
>other : Symbol(other, Decl(index.js, 1, 6))
|
||||
|
||||
import defaultFoo from "./other.js";
|
||||
>defaultFoo : Symbol(defaultFoo, Decl(index.js, 2, 6))
|
||||
|
||||
const x = new Foo();
|
||||
>x : Symbol(x, Decl(index.js, 4, 5))
|
||||
|
||||
const y = other.Foo();
|
||||
>y : Symbol(y, Decl(index.js, 5, 5))
|
||||
>other : Symbol(other, Decl(index.js, 1, 6))
|
||||
|
||||
const z = new defaultFoo();
|
||||
>z : Symbol(z, Decl(index.js, 6, 5))
|
||||
|
||||
=== tests/cases/compiler/other.d.ts ===
|
||||
export interface Foo {
|
||||
>Foo : Symbol(Foo, Decl(other.d.ts, 0, 0))
|
||||
|
||||
bar: number;
|
||||
>bar : Symbol(Foo.bar, Decl(other.d.ts, 0, 22))
|
||||
}
|
||||
|
||||
export default interface Bar {
|
||||
>Bar : Symbol(Bar, Decl(other.d.ts, 2, 1))
|
||||
|
||||
foo: number;
|
||||
>foo : Symbol(Bar.foo, Decl(other.d.ts, 4, 30))
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/other.js ===
|
||||
export class Foo {
|
||||
>Foo : Symbol(Foo, Decl(other.js, 0, 0))
|
||||
|
||||
bar = 2.4;
|
||||
>bar : Symbol(Foo.bar, Decl(other.js, 0, 18))
|
||||
}
|
||||
|
||||
export default class Bar {
|
||||
>Bar : Symbol(Bar, Decl(other.js, 2, 1))
|
||||
|
||||
foo = 1.2;
|
||||
>foo : Symbol(Bar.foo, Decl(other.js, 4, 26))
|
||||
}
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
=== tests/cases/compiler/index.js ===
|
||||
import { Foo } from "./other.js";
|
||||
>Foo : any
|
||||
|
||||
import * as other from "./other.js";
|
||||
>other : typeof other
|
||||
|
||||
import defaultFoo from "./other.js";
|
||||
>defaultFoo : any
|
||||
|
||||
const x = new Foo();
|
||||
>x : error
|
||||
>new Foo() : error
|
||||
>Foo : error
|
||||
|
||||
const y = other.Foo();
|
||||
>y : error
|
||||
>other.Foo() : error
|
||||
>other.Foo : error
|
||||
>other : typeof other
|
||||
>Foo : any
|
||||
|
||||
const z = new defaultFoo();
|
||||
>z : error
|
||||
>new defaultFoo() : error
|
||||
>defaultFoo : error
|
||||
|
||||
=== tests/cases/compiler/other.d.ts ===
|
||||
export interface Foo {
|
||||
bar: number;
|
||||
>bar : number
|
||||
}
|
||||
|
||||
export default interface Bar {
|
||||
foo: number;
|
||||
>foo : number
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/other.js ===
|
||||
export class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
bar = 2.4;
|
||||
>bar : number
|
||||
>2.4 : 2.4
|
||||
}
|
||||
|
||||
export default class Bar {
|
||||
>Bar : Bar
|
||||
|
||||
foo = 1.2;
|
||||
>foo : number
|
||||
>1.2 : 1.2
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user