Say I have this JSON file:
{
"foo": 1,
"bar": true,
"baz": "yes"
}
is there a way to import that file and get static typing with TypeScript?
with plain Node.js, we do:
const json = require('./file.json');
but with TS, is there a way to do:
import json = require('./file.json');
is there not a way to get static typing like this? It should be easy, right?
IMO, you should just be able to do
typeof 'path/to/json/file.json'
so that would be:
export type MyInterface = typeof 'path/to/json/file.json'
and that will give you a type.