Open ianwremmel opened 9 months ago
+1, same Behavior on Windows. My build is blocked on typedoc --validation.
Hm, we don't have those comments in our code... @JamesHenry do you know what would cause tsc
to put these comments in? :thinking:
We seem to have an old node types reference in our package.json -> "@types/node": "18.19.8",
- I think that could be dragging in old typings (I'm basing that on the pnpm reference that gets created):
node_modules/.pnpm/@types+node@18.19.8/node_modules/@types/node/ts4.8/fs.d.ts
Actually it seems the issue with the old typings is already resolved:
https://www.npmjs.com/package/nx/v/19.1.1?activeTab=code
I opened a node 20 typings PR just in case we want that but feel free to close again if we don't @FrozenPandaz: https://github.com/nrwl/nx/pull/26260
Somebody will need to look into why the JsInputs
etc types are not being generated by napi-rs
, because that still seems to be an issue on the latest.
It looks like the latest release introduces more invalid typings. Somewhere along the way | undefined
got added to a bunch of things, so the current nested referencing of e.g. NxJsonConfiguration['release']['changelog']
is invalid. ~Here's the latest patch I'm using:~
edit: deleted patch because it was large and not relevant
Actually, wait, I take that back. That's for the latest 18.x release. I haven't upgrade to 19 yet. Let me do that and get back to you.
ok, yea, the type references have been fixed, but the generated types have indeed gotten more problematic. Here's that patch I need with v19.1.1
to make typescript happy:
diff --git a/node_modules/nx/bin/nx-cloud.js b/node_modules/nx/bin/nx-cloud.js
old mode 100755
new mode 100644
diff --git a/node_modules/nx/src/command-line/release/config/config.d.ts b/node_modules/nx/src/command-line/release/config/config.d.ts
index 04c2921..e31b942 100644
--- a/node_modules/nx/src/command-line/release/config/config.d.ts
+++ b/node_modules/nx/src/command-line/release/config/config.d.ts
@@ -25,6 +25,11 @@ type RemoveBooleanFromPropertiesOnEach<T, K extends keyof T[keyof T]> = {
[U in keyof T]: RemoveBooleanFromProperties<T[U], K>;
};
export declare const IMPLICIT_DEFAULT_RELEASE_GROUP = "__default__";
+
+type DefiniteRelease = Exclude<NxJsonConfiguration['release'], undefined>;
+type DefiniteChangeLog = Exclude<DefiniteRelease['changelog'], undefined>;
+type DefiniteConventionalCommits = Exclude<DefiniteRelease['conventionalCommits'], undefined>;
+type DefiniteTypes = Exclude<DefiniteConventionalCommits['types'], undefined>;
/**
* Our source of truth is a deeply required variant of the user-facing config interface, so that command
* implementations can be sure that properties will exist and do not need to repeat the same checks over
@@ -34,11 +39,11 @@ export declare const IMPLICIT_DEFAULT_RELEASE_GROUP = "__default__";
* it easier to work with (the user could be specifying a single string, and they can also use any valid matcher
* pattern such as directories and globs).
*/
-export type NxReleaseConfig = Omit<DeepRequired<NxJsonConfiguration['release'] & {
- groups: DeepRequired<RemoveTrueFromPropertiesOnEach<EnsureProjectsArray<NxJsonConfiguration['release']['groups']>, 'changelog'>>;
- changelog: RemoveTrueFromProperties<DeepRequired<NxJsonConfiguration['release']['changelog']>, 'workspaceChangelog' | 'projectChangelogs'>;
+export type NxReleaseConfig = Omit<DeepRequired<DefiniteRelease & {
+ groups: DeepRequired<RemoveTrueFromPropertiesOnEach<EnsureProjectsArray<DefiniteRelease['groups']>, 'changelog'>>;
+ changelog: RemoveTrueFromProperties<DeepRequired<DefiniteChangeLog>, 'workspaceChangelog' | 'projectChangelogs'>;
conventionalCommits: {
- types: RemoveBooleanFromPropertiesOnEach<DeepRequired<RemoveBooleanFromProperties<DeepRequired<NxJsonConfiguration['release']['conventionalCommits']['types']>, string>>, 'changelog'>;
+ types: RemoveBooleanFromPropertiesOnEach<DeepRequired<RemoveBooleanFromProperties<DeepRequired<DefiniteTypes>, string>>, 'changelog'>;
};
}>, 'projects'>;
export interface CreateNxReleaseConfigError {
diff --git a/node_modules/nx/src/command-line/release/config/filter-release-groups.d.ts b/node_modules/nx/src/command-line/release/config/filter-release-groups.d.ts
index bffd713..4a50e9c 100644
--- a/node_modules/nx/src/command-line/release/config/filter-release-groups.d.ts
+++ b/node_modules/nx/src/command-line/release/config/filter-release-groups.d.ts
@@ -1,6 +1,7 @@
import { ProjectGraph } from '../../../config/project-graph';
import { NxReleaseConfig } from './config';
-export type ReleaseGroupWithName = NxReleaseConfig['groups'][string] & {
+type DefiniteGroups = Exclude<NxReleaseConfig['groups'], undefined>;
+export type ReleaseGroupWithName = DefiniteGroups[string] & {
name: string;
};
export declare function filterReleaseGroups(projectGraph: ProjectGraph, nxReleaseConfig: NxReleaseConfig, projectsFilter?: string[], groupsFilter?: string[]): {
diff --git a/node_modules/nx/src/native/index.d.ts b/node_modules/nx/src/native/index.d.ts
index 3bd096b..71f4d62 100644
--- a/node_modules/nx/src/native/index.d.ts
+++ b/node_modules/nx/src/native/index.d.ts
@@ -1,6 +1,13 @@
/* tslint:disable */
/* eslint-disable */
+type JsInputs = unknown
+type JsExternal = unknown
+type HashInstruction = unknown
+type ProjectFiles = unknown
+type ProjectRootMappings = unknown
+type NapiDashMap = unknown
+
/* auto-generated by NAPI-RS */
export class ExternalObject<T> {
Any update on a permanent fix? We're currently experiencing these issues migrating our workspace from nx 15 to 19
Current Behavior
nx 18 induces the following type errors:
Expected Behavior
no type errors
GitHub Repo
No response
Steps to Reproduce
Nx Report
Failure Logs
No response
Package Manager Version
10.2.4
Operating System
Additional Information
From what I can tell, there are two issues here:
src/native/index.d.ts
is generated from rust code. This has been a known issue since atleast 17.2.0.src/utils/fileutils.d.ts
andsrc/generators/tree.d.ts
include/// <reference types="@types/node/ts4.8/fs" />
, which induces a second import of the typedefs for node'sfs
.The following diff fixes the issues: