The goal here is to export
/import
modern ES modules.
type="module"
in your script tag.import
specify the .js
file extension so that the browser can find the
file.JavaScript built-in types can be checked using the typeof
operator: boolean
,
number
or bigint
, string
, symbol
or object
.
So typeof
applied to any of your custom class
es will return object
. To get
the actual class name, check yourInstance.constructor.name
.
Your IDE can check your types by checking your JSDoc comments, which allows your IDE to check types, including your own custom types.
If you provide an API, you can even generate .dt.ts
files from JavaScript files using JSDoc.
You can use TypeScript type checking in JavaScript projects and even use a jsconfig.json
Define as many <template>
s as your
need and replace the DOM node by their cloned content.
Instead of running node mycode.js
, run node --watch mycode.js