Skip to content

Commit e9a7752

Browse files
committed
remove dead code
1 parent f92dacd commit e9a7752

File tree

1 file changed

+5
-59
lines changed

1 file changed

+5
-59
lines changed

cli/tsc/97_ts_host.js

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -744,22 +744,6 @@ ts.setLocalizedDiagnosticMessages((() => {
744744
};
745745
})());
746746

747-
/** @param {ts.Diagnostic} diagnostic */
748-
function isLibDiagnostic(diagnostic) {
749-
return diagnostic.file?.fileName.startsWith("asset:///") ||
750-
diagnostic.file?.fileName?.includes("@types/node");
751-
}
752-
753-
/** @param {ts.DiagnosticMessageChain | string} messageText */
754-
function getTopLevelMessageText(messageText) {
755-
if (typeof messageText === "string") {
756-
return messageText;
757-
} else if (typeof messageText.messageText === "string") {
758-
return messageText.messageText;
759-
}
760-
return undefined;
761-
}
762-
763747
/** @param {ts.Diagnostic} diagnostic */
764748
export function filterMapDiagnostic(diagnostic) {
765749
if (IGNORED_DIAGNOSTICS.includes(diagnostic.code)) {
@@ -780,51 +764,9 @@ export function filterMapDiagnostic(diagnostic) {
780764
}
781765
}
782766

783-
// // allow assigning a globalThis.URL to "node:url".URL
784-
// if (
785-
// checkDiagnosticAndChain(diagnostic, (d) => {
786-
// return d.code === 2322 && d.messageText ===
787-
// "Type 'URL' is not assignable to type 'import(\"url\").URL'.";
788-
// })
789-
// ) {
790-
// return false;
791-
// }
792-
793767
return true;
794768
}
795769

796-
/**
797-
* @param {ts.Diagnostic} diagnostic
798-
* @param {(d: { code: number, messageText: string }) => boolean} check
799-
*/
800-
function checkDiagnosticAndChain(diagnostic, check) {
801-
if (typeof diagnostic.messageText === "string") {
802-
return check(
803-
/** @type {{ code: number, messageText: string }} */ (diagnostic),
804-
);
805-
} else {
806-
return checkDiagnosticMessageChain(diagnostic.messageText, check);
807-
}
808-
}
809-
810-
/**
811-
* @param {ts.DiagnosticMessageChain} dmc
812-
* @param {(d: ts.DiagnosticMessageChain) => boolean} check
813-
*/
814-
function checkDiagnosticMessageChain(dmc, check) {
815-
if (check(dmc)) {
816-
return true;
817-
}
818-
if (dmc.next) {
819-
for (const next of dmc.next) {
820-
if (checkDiagnosticMessageChain(next, check)) {
821-
return true;
822-
}
823-
}
824-
}
825-
return false;
826-
}
827-
828770
// list of globals that should be kept in Node's globalThis
829771
ts.deno.setNodeOnlyGlobalNames(
830772
new Set([
@@ -853,7 +795,11 @@ ts.deno.setNodeOnlyGlobalNames(
853795
"setTimeout",
854796
]),
855797
);
856-
// list of globals in @types/node that collide with Deno
798+
// List of globals in @types/node that collide with Deno's types.
799+
// When the `@types/node` package attempts to assign to these types
800+
// if the type is already in the global symbol table, then assignment
801+
// will be a no-op, but if the global type does not exist then the package can
802+
// create the global.
857803
const setTypesNodeIgnorableNames = new Set([
858804
"AbortController",
859805
"AbortSignal",

0 commit comments

Comments
 (0)