Skip to content

Commit fc598b6

Browse files
author
Heiner Pöpping
committed
Add global types to template
1 parent aa16935 commit fc598b6

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ async function createChaynsApp({
235235
// copy tsconfig.json
236236
if(chooseTypescript === YesOrNo.Yes) {
237237
await copyFile(getTemplatePath(`../templates/api-v5/shared/ts/tsconfig.json`), path.join(destination, 'tsconfig.json'));
238+
239+
if (!fs.existsSync(path.join(destination, '/src/types'))) {
240+
fs.mkdirSync(path.join(destination, '/src/types'));
241+
}
242+
await copyFile(getTemplatePath(`../templates/api-v5/shared/ts/src/types/global.d.ts`), path.join(destination, '/src/types/global.d.ts'));
238243
}
239244

240245
const fileDestination = path.join(destination, 'toolkit.config.js');
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
declare module '*.png' {
2+
const value: string;
3+
export = value;
4+
}
5+
6+
declare module '*.png?url' {
7+
const value: string;
8+
export = value;
9+
}
10+
11+
declare module '*.svg?url' {
12+
const value: string;
13+
export = value;
14+
}
15+
16+
interface ImportMetaEnv {
17+
[key: string]: string
18+
}
19+
20+
interface ImportMeta {
21+
readonly env: ImportMetaEnv
22+
}

0 commit comments

Comments
 (0)