Skip to content

Commit

Permalink
misc(types): correct types
Browse files Browse the repository at this point in the history
  • Loading branch information
misterdev committed May 28, 2019
1 parent 8b6d47b commit 85ef3e7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
17 changes: 9 additions & 8 deletions packages/generators/init-generator.ts
@@ -1,7 +1,6 @@
import chalk from "chalk";
import * as logSymbols from "log-symbols";
import * as Generator from "yeoman-generator";
import * as Inquirer from "inquirer";
import * as path from "path";

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

const { multiEntries }: { multiEntries: boolean } = await this.prompt([
const { multiEntries } = await this.prompt([
Confirm(
"multiEntries",
"Will your application have multiple bundles?",
false
),
]);

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

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

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

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

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

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

// Genrate tsconfig
Expand Down
4 changes: 2 additions & 2 deletions packages/generators/utils/entry.ts
Expand Up @@ -19,9 +19,9 @@ interface CustomGenerator extends Generator {
export default function entry(
self: CustomGenerator,
multiEntries: boolean,
): Promise<object | string> {
): Promise<void | {}> {
let entryIdentifiers: string[];
let result: Promise<{}>;
let result: Promise<void | {}>;
if (multiEntries) {
result = self
.prompt([
Expand Down
4 changes: 2 additions & 2 deletions packages/generators/utils/language.ts
Expand Up @@ -57,7 +57,7 @@ function getEntryFolders(self): string[] {
* @returns {ModuleRule} A configuration containing the babel-loader with env preset
*/
export function getBabelLoader(includeFolders: string[]): ModuleRule {
const include = includeFolders.map((folder: string) =>
const include = includeFolders.map((folder: string): string =>
`path.resolve(__dirname, '${folder}')`
);
return {
Expand Down Expand Up @@ -85,7 +85,7 @@ export function getBabelLoader(includeFolders: string[]): ModuleRule {
* @returns {ModuleRule} A configuration containing the ts-loader
*/
export function getTypescriptLoader(includeFolders: string[]): ModuleRule {
const include = includeFolders.map((folder: string) =>
const include = includeFolders.map((folder: string): string =>
`path.resolve(__dirname, '${folder}')`
);
return {
Expand Down

0 comments on commit 85ef3e7

Please sign in to comment.