-
Notifications
You must be signed in to change notification settings - Fork 23
chore(editor): TS warnings and errors from new variants field
#4649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
4c8e943 to
a4dd7ad
Compare
a4dd7ad to
be9f9f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Suggestion:
Two SerializableFoundNode object literals are missing the required currentVariant property, which will cause TypeScript compilation errors after this PR's changes add it to the type definition.
View Details
📝 Patch Details
diff --git a/packages/fern-docs/components/src/navigation/NavigationStore.ts b/packages/fern-docs/components/src/navigation/NavigationStore.ts
index 2ba7318e9..f1148ff19 100644
--- a/packages/fern-docs/components/src/navigation/NavigationStore.ts
+++ b/packages/fern-docs/components/src/navigation/NavigationStore.ts
@@ -304,6 +304,7 @@ export class NavigationStore {
currentTab: tabSlug ? ({ slug: tabSlug } as any) : undefined,
currentVersion: version,
currentProduct: product,
+ currentVariant: undefined,
isCurrentVersionDefault: false,
isCurrentProductDefault: false
};
@@ -588,6 +589,7 @@ export class NavigationStore {
currentTab: pageSearchResult.tabSlug ? ({ slug: pageSearchResult.tabSlug } as any) : undefined,
currentVersion: pageSearchResult.version,
currentProduct: pageSearchResult.product,
+ currentVariant: undefined,
isCurrentVersionDefault: false,
isCurrentProductDefault: false
};
diff --git a/packages/fern-docs/components/src/navigation/__tests__/migrations.test.ts b/packages/fern-docs/components/src/navigation/__tests__/migrations.test.ts
index fa02cafc2..854c3e100 100644
--- a/packages/fern-docs/components/src/navigation/__tests__/migrations.test.ts
+++ b/packages/fern-docs/components/src/navigation/__tests__/migrations.test.ts
@@ -47,6 +47,7 @@ describe("migrations", () => {
currentTab: undefined,
currentVersion: undefined,
currentProduct: undefined,
+ currentVariant: undefined,
isCurrentVersionDefault: true,
isCurrentProductDefault: true
}
Analysis
Missing currentVariant property in SerializableFoundNode object literals causes TypeScript compilation errors
What fails: NavigationStore.ts contextForExtraction objects (lines 298, 582) and migrations test file (line 46) missing required currentVariant property for SerializableFoundNode type
How to reproduce:
cd packages/fern-docs/components && pnpm exec tsc --noEmitResult: TypeScript compilation fails with errors:
src/navigation/NavigationStore.ts(298,15): error TS2741: Property 'currentVariant' is missing in type ... but required in type 'SerializableFoundNode'src/navigation/NavigationStore.ts(582,27): error TS2741: Property 'currentVariant' is missing in type ... but required in type 'SerializableFoundNode'src/navigation/__tests__/migrations.test.ts(26,29): error TS2741: Property 'currentVariant' is missing in type ... but required in type 'SerializableFoundNode'
Expected: TypeScript compilation should pass without errors. The SerializableFoundNode type definition includes currentVariant in its Pick type (line 25 in types.ts), so all object literals typed as SerializableFoundNode must include this property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Suggestion:
Two SerializableFoundNode object literals are missing the required currentVariant field, which will cause TypeScript compilation errors since this field is now part of the type definition.
View Details
📝 Patch Details
diff --git a/packages/fern-docs/components/src/navigation/NavigationStore.ts b/packages/fern-docs/components/src/navigation/NavigationStore.ts
index 3ea91ec5c..0f4d85cd7 100644
--- a/packages/fern-docs/components/src/navigation/NavigationStore.ts
+++ b/packages/fern-docs/components/src/navigation/NavigationStore.ts
@@ -327,6 +327,7 @@ export class NavigationStore {
currentTab: tabSlug ? ({ slug: tabSlug } as any) : undefined,
currentVersion: version,
currentProduct: product,
+ currentVariant: undefined,
isCurrentVersionDefault: false,
isCurrentProductDefault: false
};
@@ -613,6 +614,7 @@ export class NavigationStore {
currentTab: pageSearchResult.tabSlug ? ({ slug: pageSearchResult.tabSlug } as any) : undefined,
currentVersion: pageSearchResult.version,
currentProduct: pageSearchResult.product,
+ currentVariant: undefined,
isCurrentVersionDefault: false,
isCurrentProductDefault: false
};
Analysis
Missing currentVariant field in SerializableFoundNode object literals causes TypeScript compilation errors
What fails: Two SerializableFoundNode object literals in NavigationStore.ts (lines 321-332 and 607-618) are missing the required currentVariant field, causing TypeScript error "Property 'currentVariant' is missing in type"
How to reproduce:
pnpm exec tsc --noEmit packages/fern-docs/components/src/navigation/NavigationStore.tsResult: TypeScript compilation fails with error TS2741 about missing currentVariant property
Expected: Should compile successfully like other SerializableFoundNode usages in migrations.ts and test files that include currentVariant: undefined
variants field
variants fieldvariants field
Related:
Short description of the changes made
Fix typescript errors in:
packages/fern-dashboard/src/app/[orgName]/(visual-editor)(PageSidebar and PageNode)packages/fern-docs/components/src/navigationWhat was the motivation & context behind this PR?
Part of ongoing effort to bring fern-dashboard back to zero-error state. At some point our builds started to pass even with compiler warnings/errors.
How has this PR been tested?
N/A