Skip to content

Commit

Permalink
fix(tree): Expand API-Extractor workaround to fix rollups, and link t…
Browse files Browse the repository at this point in the history
…o related github issue (microsoft#19465)

Adds additional workaround for existing issue, and links to
microsoft/rushstack#4507
  • Loading branch information
Josmithr authored and alexvy86 committed Feb 8, 2024
1 parent dac962f commit 5455dc8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/dds/tree/api-report/tree.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1654,10 +1654,10 @@ export class test_RecursiveObject extends test_RecursiveObject_base {

// @internal
export const test_RecursiveObject_base: TreeNodeSchemaClass<"Test Recursive Domain.testObject", NodeKind.Object, object & TreeNode & ObjectFromSchemaRecord< {
readonly recursive: FieldSchema<import("./schemaTypes.js").FieldKind.Optional, readonly [() => typeof test_RecursiveObject]>;
readonly recursive: FieldSchema<FieldKind.Optional, readonly [() => typeof test_RecursiveObject]>;
readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
}> & WithType<"Test Recursive Domain.testObject">, object & InsertableObjectFromSchemaRecord< {
readonly recursive: FieldSchema<import("./schemaTypes.js").FieldKind.Optional, readonly [() => typeof test_RecursiveObject]>;
readonly recursive: FieldSchema<FieldKind.Optional, readonly [() => typeof test_RecursiveObject]>;
readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
}>, true>;

Expand Down
2 changes: 1 addition & 1 deletion packages/dds/tree/src/domains/json/jsonDomainSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Adding this unused import makes the generated d.ts file produced by TypeScript stop breaking API-Extractor's rollup generation.
// Without this import, TypeScript generates inline `import("../..")` statements in the d.ts file,
// which API-Extractor leaves as is when generating the rollup, leaving them pointing at the wrong directory.
// TODO: Understand and/or remove the need for this workaround.
// API-Extractor issue: https://github.com/microsoft/rushstack/issues/4507
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports
import { ValueSchema } from "../../core/index.js";

Expand Down
9 changes: 3 additions & 6 deletions packages/dds/tree/src/simple-tree/testRecursiveDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ import { SchemaFactoryRecursive } from "./schemaFactoryRecursive.js";
// This type is referred to by the base type generated by builder.object.
// Adding the import of it here prevents TypeScript from generating inline includes for it in the d.ts file.
// If we let TypeScript generate these includes, they use relative paths which break API extractor's rollup.
import { type NodeKind as _dummy } from "./schemaTypes.js";

{
// Unused imports are an error, so make an unused type to use it.
type _X = _dummy;
}
// API-Extractor issue: https://github.com/microsoft/rushstack/issues/4507
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports
import { type NodeKind, type FieldKind } from "./schemaTypes.js";

const builder = new SchemaFactoryRecursive("Test Recursive Domain");

Expand Down

0 comments on commit 5455dc8

Please sign in to comment.