Skip to content

Commit

Permalink
improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Sep 7, 2024
1 parent 99d32db commit a7147cf
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 65 deletions.
72 changes: 18 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"semver": "^7.5.4",
"simple-git": "^3.20.0",
"sort-keys": "^5.0.0",
"text-table": "^0.2.0"
"text-table": "^0.2.0",
"type-fest": "^4.26.0"
},
"devDependencies": {
"@types/debug": "^4.1.9",
Expand Down
9 changes: 5 additions & 4 deletions src/actions/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,12 @@ export abstract class TasksMixin {
async composeWith<G extends BaseGenerator = BaseGenerator>(generator: string[], immediately?: boolean): Promise<G[]>;
async composeWith<G extends BaseGenerator = BaseGenerator>(
generator: string | { Generator: any; path: string },
options: Partial<GetGeneratorOptions<G>>,
options: { generatorOptions: never; generatorArgs: never } & Partial<GetGeneratorOptions<G>>,
immediately?: boolean,
): Promise<G>;
async composeWith<G extends BaseGenerator = BaseGenerator>(
generator: string[],
options: Partial<GetGeneratorOptions<G>>,
options: { generatorOptions: never; generatorArgs: never } & Partial<GetGeneratorOptions<G>>,
immediately?: boolean,
): Promise<G[]>;
async composeWith<G extends BaseGenerator = BaseGenerator>(
Expand All @@ -475,9 +475,10 @@ export abstract class TasksMixin {
options?: Partial<GetGeneratorOptions<G>>,
immediately?: boolean,
): Promise<G[]>;
async composeWith<G extends BaseGenerator = BaseGenerator>(
async composeWith<const G extends BaseGenerator = BaseGenerator>(
this: G,
generator: string,
options?: ComposeOptions<G>,
options: ComposeOptions<G>,
): Promise<G[]>;

async composeWith<G extends BaseGenerator = BaseGenerator>(
Expand Down
20 changes: 14 additions & 6 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import type {
BaseGenerator,
ComposeOptions as EnvironmentComposeOptions,
GeneratorFeatures as FeaturesApi,
GetGeneratorOptions,
GeneratorOptions as OptionsApi,
ProgressOptions,
} from '@yeoman/types';
import type { Simplify } from 'type-fest';
import type { JSONSchema7Type } from 'json-schema';
import type { PipelineOptions } from 'mem-fs';
import type { MemFsEditorFile } from 'mem-fs-editor';
Expand Down Expand Up @@ -174,9 +176,15 @@ export type CliOptionSpec = {
storage?: string | Storage;
};

export type ComposeOptions<G extends BaseGenerator = BaseGenerator> = EnvironmentComposeOptions<G> & {
destinationRoot?: string;
skipEnvRegister?: boolean;
forceResolve?: boolean;
forwardOptions?: boolean;
};
export type ComposeOptions<G extends BaseGenerator = BaseGenerator> = Simplify<
EnvironmentComposeOptions<G> &
{
generatorOptions?: {
destinationRoot?: string;
} & Partial<GetGeneratorOptions<G>>;
skipEnvRegister?: boolean;
forceResolve?: boolean;
forwardOptions?: boolean;
}

>;

0 comments on commit a7147cf

Please sign in to comment.