Skip to content

Commit d5068ee

Browse files
tylerjusflyIfycode
authored andcommitted
fix: replaced all any types to a proper type in template.ts
1 parent d5a17bc commit d5068ee

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/interfaces.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ export interface TemplateQuestions {
66
default: string;
77
}
88

9-
export type ItemplateOptions = "ts" | "esm" | "cjs";
9+
export type ItemplateOptions = string;
1010

1111
export interface Ioptions {
12-
skipPrompts: boolean;
12+
skipPrompts: boolean;
1313
git: boolean;
1414
skipGit: string | undefined;
1515
folderName: string;
@@ -20,4 +20,8 @@ export interface Ioptions {
2020
skipInstall: boolean;
2121
help: string | boolean;
2222
version: string | boolean;
23+
}
24+
25+
export interface IFoldernameAnswers {
26+
folderName:string
2327
}

src/prompts/template.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import inquirer from 'inquirer';
22
import chalk from 'chalk';
3-
import { TemplateQuestions } from '../interfaces';
3+
import { IFoldernameAnswers, Ioptions, ItemplateOptions, TemplateQuestions } from '../interfaces';
44

5-
let skipPromptsModified = (options: any, defaultFolderName: string, notAmongTemplateCollection: any, defaultTemplate: string) => {
5+
let skipPromptsModified = (options: Ioptions, defaultFolderName: string, notAmongTemplateCollection: boolean, defaultTemplate: ItemplateOptions) => {
66
if (notAmongTemplateCollection && (options.template !== undefined || options.template === undefined)) {
77
options.template = defaultTemplate;
88
}
@@ -18,7 +18,7 @@ let skipPromptsModified = (options: any, defaultFolderName: string, notAmongTemp
1818
return options;
1919
}
2020

21-
export const templateMissingOptionPrompt = async (options: any, folderNameAnswers: any, defaultFolderName: string) => {
21+
export const templateMissingOptionPrompt = async (options: Ioptions, folderNameAnswers: IFoldernameAnswers, defaultFolderName: string) => {
2222
const templateQuestions: TemplateQuestions[] = [];
2323

2424
const apiTemplate = {
@@ -73,7 +73,7 @@ export const templateMissingOptionPrompt = async (options: any, folderNameAnswer
7373
if (!options.skipPrompts) templateAnswers = await inquirer.prompt(templateQuestions);
7474

7575
// Transform template name/answers back to abbrev name for cli to process it accordingly
76-
const transformTemplateName = (templateOption: any) => {
76+
const transformTemplateName = (templateOption: string) => {
7777
if (templateOption === defaultTemplate) templateAnswers.template = apiTemplate.ts.abbrev;
7878
if (templateOption === esmTemplate) templateAnswers.template = apiTemplate.esm.abbrev;
7979
if (templateOption === cjsTemplate) templateAnswers.template = apiTemplate.cjs.abbrev;

0 commit comments

Comments
 (0)