TypeScript in Moyuk
Moyuk's TypeScript aims to be as compatible as possible with Deno's. (Not fully compatible yet.)
tsconfig.json
Moyuk doesn't support customizing compiler options yet. The tsconfig.json set by Moyuk looks like this:
{
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"inlineSourceMap": true,
"isolatedModules": true,
"module": "esnext",
"moduleDetection": "force",
"strict": true,
"target": "esnext",
"useDefineForClassFields": true
}
}
Moyuk's compiler options are basically same as Deno's.
Import
You can import modules from https:
or npm:
URLs just like in Deno.
Moyuk currently supports importing modules from:
npm:
URLs. (e.g.npm:marked@^4.2
)https:
URLs that refer to TypeScript files. (e.g.https://deno.land/[email protected]/async/mod.ts
)https:
URLs that refer to JavaScript files with X-TypeScript-Types header. (e.g.https://esm.sh/[email protected]
)
Using npm packages
Importing npm packages with npm specifiers
Moyuk supports importing modules from npm packages via npm:
URL.
import { marked } from 'npm:marked@^4.2';
Moyuk uses esm.sh internally to resolve npm specifiers.
Not all npm packages work with Moyuk. Npm packages that use Node.js built-in modules or native modules won't work.
Importing npm packages with CDNs
Moyuk supports importing modules from CDNs that support X-TypeScript-Types header via https:
URL.
import { marked } from 'https://esm.sh/[email protected]';
Here is the list of the CDNs that support X-TypeScript-Types
:
TypeScript version
You can check the TypeScript version in the App Info tab. Moyuk uses the latest TypeScript version.