How to reference js files in typescript

A js file is referenced in a ts

import jsFile from "./js/jsFile"

within this jsFile, the syntax of es6 is used again

// jsFile
import other from "./other.js"
export default other

then I reported an error, saying that the unexpected token import, in jsFile is about as follows. I hope to solve the whole packaging process.
at present, it is packaged using tsc index.ts. Should I add a layer to convert the es6 of js to es5, and then quote it?

[picture]
clipboard.png

Oct.09,2021

indicates that your running environment does not support import, and ts will not move the


ts of the js file you cited cannot interact directly with js. Use external declaration to describe the type information of the js code before you can import the js file. The landlord has not yet mastered the essence of ts. I have recently signed up a TypeScript tutorial. Work with heart. Welcome to watch TypeScript crash course

.
Menu