Skip to content

Commit

Permalink
Maybe fix the default thing
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed May 7, 2024
1 parent 10a07ad commit 739c9bf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/checkModuleFormat.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ console.log(`Testing ${typescript}...`);
/** @type {[fn: (() => Promise<any>), shouldSucceed: boolean][]} */
const fns = [
[() => require(typescript).version, true],
[() => require(typescript).default.version, false],
[() => require(typescript).default.version, true],
[() => __importDefault(require(typescript)).version, false],
[() => __importDefault(require(typescript)).default.version, true],
[() => __importStar(require(typescript)).version, true],
Expand Down
2 changes: 2 additions & 0 deletions scripts/dtsBundler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ function isSelfReference(reference, symbol) {
* @param {ts.Symbol} moduleSymbol
*/
function emitAsNamespace(name, parent, moduleSymbol, needExportModifier) {
if (name === "default") return;

assert(moduleSymbol.flags & ts.SymbolFlags.ValueModule, "moduleSymbol is not a module");

const fullName = parent ? `${parent}.${name}` : name;
Expand Down
2 changes: 2 additions & 0 deletions src/typescript/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ if (typeof console !== "undefined") {
}

export * from "./_namespaces/ts.js";
import * as ts from "./_namespaces/ts.js";
export default ts;
5 changes: 5 additions & 0 deletions testImportESM.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as ts from "./built/local/typescript.js";
import ts2 from "./built/local/typescript.js";

console.log(ts.version);
console.log(ts2.version);

0 comments on commit 739c9bf

Please sign in to comment.