File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 */
77import { DenoDir } from '@deno/cache-dir' ;
88import { join } from '@std/path' ;
9+ import { lessThan , parse } from '@std/semver' ;
910// n.b. ts-morph is a sibling devDependency of typescript, so that the module
1011// loader will resolve our project's typescript package, not the transient
1112// dependency of ts-morph. We only want to reference our typescript dependency
@@ -21,6 +22,18 @@ import {
2122} from 'ts-morph' ;
2223import { version as npmVersion } from 'typescript' ;
2324
25+ // Warn if the NPM "typescript" package is behind Deno's bundled TypeScript
26+ const denoTSVersion = Deno . version . typescript ;
27+ const npmTS = parse ( npmVersion ) ;
28+ const denoTS = parse ( denoTSVersion ) ;
29+
30+ // Compare only major.minor (ignore patch) by zeroing it out before comparing
31+ if ( lessThan ( { ...npmTS , patch : 0 } , { ...denoTS , patch : 0 } ) ) {
32+ console . warn (
33+ `⚠️ Types Mismatch: Extracting types from TypeScript ${ npmVersion } , but Deno v${ Deno . version . deno } is using TypeScript ${ denoTSVersion } ` ,
34+ ) ;
35+ }
36+
2437// List of types we directly reference from the dom lib. Only interface and type
2538// alias identifiers are valid, since other syntax types (class, function, var)
2639// are implementations, which will not be available outside of the browser.
You can’t perform that action at this time.
0 commit comments