@@ -744,22 +744,6 @@ ts.setLocalizedDiagnosticMessages((() => {
744
744
} ;
745
745
} ) ( ) ) ;
746
746
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
-
763
747
/** @param {ts.Diagnostic } diagnostic */
764
748
export function filterMapDiagnostic ( diagnostic ) {
765
749
if ( IGNORED_DIAGNOSTICS . includes ( diagnostic . code ) ) {
@@ -780,51 +764,9 @@ export function filterMapDiagnostic(diagnostic) {
780
764
}
781
765
}
782
766
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
-
793
767
return true ;
794
768
}
795
769
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
-
828
770
// list of globals that should be kept in Node's globalThis
829
771
ts . deno . setNodeOnlyGlobalNames (
830
772
new Set ( [
@@ -853,7 +795,11 @@ ts.deno.setNodeOnlyGlobalNames(
853
795
"setTimeout" ,
854
796
] ) ,
855
797
) ;
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.
857
803
const setTypesNodeIgnorableNames = new Set ( [
858
804
"AbortController" ,
859
805
"AbortSignal" ,
0 commit comments