Skip to content

Commit

Permalink
chore(core): tweak nx-plugin-v2 options typing (#19673)
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder authored Oct 17, 2023
1 parent a6d8824 commit 882dd08
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
6 changes: 3 additions & 3 deletions docs/generated/devkit/CreateDependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#### Type parameters

| Name | Type |
| :--- | :---------------------------------------------------------------------- |
| `T` | extends `Record`<`string`, `unknown`\> = `Record`<`string`, `unknown`\> |
| Name | Type |
| :--- | :-------- |
| `T` | `unknown` |

#### Type declaration

Expand Down
6 changes: 3 additions & 3 deletions docs/generated/devkit/CreateNodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ A pair of file patterns and [CreateNodesFunction](../../devkit/documents/CreateN

#### Type parameters

| Name | Type |
| :--- | :---------------------------------------------------------------------- |
| `T` | extends `Record`<`string`, `unknown`\> = `Record`<`string`, `unknown`\> |
| Name | Type |
| :--- | :-------- |
| `T` | `unknown` |
6 changes: 3 additions & 3 deletions docs/generated/devkit/CreateNodesFunction.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#### Type parameters

| Name | Type |
| :--- | :---------------------------------------------------------------------- |
| `T` | extends `Record`<`string`, `unknown`\> = `Record`<`string`, `unknown`\> |
| Name | Type |
| :--- | :-------- |
| `T` | `unknown` |

#### Type declaration

Expand Down
6 changes: 3 additions & 3 deletions docs/generated/devkit/NxPluginV2.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ A plugin for Nx which creates nodes and dependencies for the [ProjectGraph](../.

#### Type parameters

| Name | Type |
| :--- | :---------------------------------------------------------------------- |
| `T` | extends `Record`<`string`, `unknown`\> = `Record`<`string`, `unknown`\> |
| Name | Type |
| :--- | :-------- |
| `T` | `unknown` |

#### Type declaration

Expand Down
18 changes: 5 additions & 13 deletions packages/nx/src/utils/nx-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ export interface CreateNodesContext {
* A function which parses a configuration file into a set of nodes.
* Used for creating nodes for the {@link ProjectGraph}
*/
export type CreateNodesFunction<
T extends Record<string, unknown> = Record<string, unknown>
> = (
export type CreateNodesFunction<T = unknown> = (
projectConfigurationFile: string,
options: T | undefined,
context: CreateNodesContext
Expand All @@ -68,9 +66,7 @@ export type CreateNodesFunction<
/**
* A pair of file patterns and {@link CreateNodesFunction}
*/
export type CreateNodes<
T extends Record<string, unknown> = Record<string, unknown>
> = readonly [
export type CreateNodes<T = unknown> = readonly [
projectFilePattern: string,
createNodesFunction: CreateNodesFunction<T>
];
Expand Down Expand Up @@ -111,19 +107,15 @@ export interface CreateDependenciesContext {
* A function which parses files in the workspace to create dependencies in the {@link ProjectGraph}
* Use {@link validateDependency} to validate dependencies
*/
export type CreateDependencies<
T extends Record<string, unknown> = Record<string, unknown>
> = (
export type CreateDependencies<T = unknown> = (
options: T | undefined,
context: CreateDependenciesContext
) => RawProjectGraphDependency[] | Promise<RawProjectGraphDependency[]>;

/**
* A plugin for Nx which creates nodes and dependencies for the {@link ProjectGraph}
*/
export type NxPluginV2<
T extends Record<string, unknown> = Record<string, unknown>
> = {
export type NxPluginV2<T = unknown> = {
name: string;

/**
Expand All @@ -148,7 +140,7 @@ export type NxPlugin = NxPluginV1 | NxPluginV2;

export type LoadedNxPlugin = {
plugin: NxPluginV2 & Pick<NxPluginV1, 'processProjectGraph'>;
options?: Record<string, unknown>;
options?: unknown;
};

// Short lived cache (cleared between cmd runs)
Expand Down

0 comments on commit 882dd08

Please sign in to comment.