How to use typescript in browser?

后端 未结 4 593
無奈伤痛
無奈伤痛 2020-12-31 04:21

utility.ts

let books = [
    { id: 1, title: \"the dark window\", author: \"krishna\", available: true },
    { id: 2, title: \"naked eye\", author: \"sydney         


        
4条回答
  •  无人及你
    2020-12-31 05:16

    I think the title is incorrect and what you really trying to do is running TypeScript applications in te browser which is totally different yo "Run TypeScript in the browser, right?

    In that case to get started with TypeScript I recommend you to not use require.js add instead a bundler-like tool like a tool like parcel, webpack, browserify, rollup. parcel is super easy : For your example, 1) remove ALL script tags and add only the following:

提交回复
热议问题