IAmKale
IAmKale
DDeno
Created by IAmKale on 11/5/2024 in #help
Can I import/reference Deno's TypeScript when bundling types?
I have the following import in a script that uses ts-morph to pull some types from TypeScript (TypeScript is currently pulled in via package.json as an entry in devDependencies):
import { version } from 'typescript';
import { version } from 'typescript';
However when I try to run this script using deno run I get the following error:
error: Relative import path "typescript" not prefixed with / or ./ or ../ and not in import map from "file:///Users/me/blah/extract-types.ts"
error: Relative import path "typescript" not prefixed with / or ./ or ../ and not in import map from "file:///Users/me/blah/extract-types.ts"
Which is leading me to believe that TypeScript is not implicitly made global when Deno runs a script, and so I need to specify an entry for it in deno.jsonc's "imports" property. Seems straightforward enough. However, I'm hoping there's a way to do so that says, "use the TypeScript bundled with Deno" instead of having to make sure I keep the declared import in sync with whatever version of Deno I'm using with the project. Is this possible?
1 replies