Skip to content

Commit 85ef3e7

Browse files
committedMay 28, 2019
misc(types): correct types
1 parent 8b6d47b commit 85ef3e7

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed
 

‎packages/generators/init-generator.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import chalk from "chalk";
22
import * as logSymbols from "log-symbols";
33
import * as Generator from "yeoman-generator";
4-
import * as Inquirer from "inquirer";
54
import * as path from "path";
65

76
import { getPackageManager } from "@webpack-cli/utils/package-manager";
@@ -142,23 +141,24 @@ export default class InitGenerator extends Generator {
142141
`Alternatively, run "webpack(-cli) --help" for usage info\n\n`,
143142
);
144143

145-
const { multiEntries }: { multiEntries: boolean } = await this.prompt([
144+
const { multiEntries } = await this.prompt([
146145
Confirm(
147146
"multiEntries",
148147
"Will your application have multiple bundles?",
149148
false
150149
),
151150
]);
152151

153-
const entryOption: string | object = await entryQuestions(self, multiEntries);
152+
// TODO string | object
153+
const entryOption: void | {} = await entryQuestions(self, multiEntries);
154154

155155
if (typeof entryOption === "string" && entryOption.length > 0) {
156156
this.configuration.config.webpackOptions.entry = `${entryOption}`;
157157
} else if (typeof entryOption === "object") {
158158
this.configuration.config.webpackOptions.entry = entryOption;
159159
}
160160

161-
const { outputDir }: { outputDir: string } = await this.prompt([
161+
const { outputDir } = await this.prompt([
162162
Input(
163163
"outputDir",
164164
"In which folder do you want to store your generated bundles?",
@@ -186,7 +186,7 @@ export default class InitGenerator extends Generator {
186186
`path.resolve(__dirname, '${outputDir}')`;
187187
}
188188

189-
const { langType }: { langType: string } = await this.prompt([
189+
const { langType } = await this.prompt([
190190
List("langType", "Will you use one of the below JS solutions?", [
191191
LangType.ES6,
192192
LangType.Typescript,
@@ -197,7 +197,7 @@ export default class InitGenerator extends Generator {
197197
langQuestionHandler(this, langType);
198198
this.langType = langType;
199199

200-
const { stylingType }: { stylingType: string } = await this.prompt([
200+
const { stylingType } = await this.prompt([
201201
List("stylingType", "Will you use one of the below CSS solutions?", [
202202
"No",
203203
StylingType.CSS,
@@ -211,7 +211,7 @@ export default class InitGenerator extends Generator {
211211

212212
if (this.isProd) {
213213
// Ask if the user wants to use extractPlugin
214-
const { useExtractPlugin }: { useExtractPlugin: string } = await this.prompt([
214+
const { useExtractPlugin } = await this.prompt([
215215
Input(
216216
"useExtractPlugin",
217217
"If you want to bundle your CSS files, what will you name the bundle? (press enter to skip)",
@@ -294,7 +294,8 @@ export default class InitGenerator extends Generator {
294294
// Generate README
295295
this.fs.copyTpl(
296296
path.resolve(__dirname, "./templates/README.md"),
297-
this.destinationPath("README.md")
297+
this.destinationPath("README.md"),
298+
{}
298299
);
299300

300301
// Genrate tsconfig

‎packages/generators/utils/entry.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ interface CustomGenerator extends Generator {
1919
export default function entry(
2020
self: CustomGenerator,
2121
multiEntries: boolean,
22-
): Promise<object | string> {
22+
): Promise<void | {}> {
2323
let entryIdentifiers: string[];
24-
let result: Promise<{}>;
24+
let result: Promise<void | {}>;
2525
if (multiEntries) {
2626
result = self
2727
.prompt([

‎packages/generators/utils/language.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function getEntryFolders(self): string[] {
5757
* @returns {ModuleRule} A configuration containing the babel-loader with env preset
5858
*/
5959
export function getBabelLoader(includeFolders: string[]): ModuleRule {
60-
const include = includeFolders.map((folder: string) =>
60+
const include = includeFolders.map((folder: string): string =>
6161
`path.resolve(__dirname, '${folder}')`
6262
);
6363
return {
@@ -85,7 +85,7 @@ export function getBabelLoader(includeFolders: string[]): ModuleRule {
8585
* @returns {ModuleRule} A configuration containing the ts-loader
8686
*/
8787
export function getTypescriptLoader(includeFolders: string[]): ModuleRule {
88-
const include = includeFolders.map((folder: string) =>
88+
const include = includeFolders.map((folder: string): string =>
8989
`path.resolve(__dirname, '${folder}')`
9090
);
9191
return {

0 commit comments

Comments
 (0)
Please sign in to comment.