Typescript compiler error when importing json file

后端 未结 6 1655
别跟我提以往
别跟我提以往 2020-12-01 15:50

So the code is simple:

calls.json

{\"SERVER\":{
    \"requests\":{
      \"one\":\"1\"
    }
} }

file.ts

import jso         


        
6条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 15:58

    Another solution is to change data.json to data.ts and export like this

    export default {
      "key" : {
        ...
      }
    }
    

    and import as you would expect:

    import { default as data } from './data'
    

提交回复
热议问题