I\'m really getting crazy because I can\'t find a solution for this. What I want to archive is to import a JSON file with a configuration into my TypeScript file. I\'ve lear
I've successfully used the following to import my package.json
inside a CLI program (so I can re-use the version, license and description information in my help page).
declare module '*.json' {
const foo: {
name: string;
version: string;
author: string;
license: string;
description: string;
};
export = foo;
}
Alternatively, you can import other files containing interface descriptions etc., but you need to put the imports inside the module declaration, e.g.
declare module 'ormconfig.json' {
import { Connection } from "typeorm";
const foo: Connection[];
export = foo;
}