-
Notifications
You must be signed in to change notification settings - Fork 409
Open
Description
Category
[ ] Enhancement
[X] Bug
[ ] Question
Version
@pnp/spfx-controls-react: 3.22.0
@pnp/sp: 4.16.0
SPFx: 1.21.1
TypeScript: 5.3
Node: 22
Expected / Desired Behavior / Question
ModernTaxonomyPicker documentation/examples should either:
- Use a valid import for taxonomy term types
- Provide a local interface for selected term objects if PnPjs v4 doesn’t have those types.
Expected: import { ITermInfo } from "@pnp/sp/taxonomy"; should resolve or docs should not reference this path.
https://pnp.github.io/sp-dev-fx-controls-react/controls/ModernTaxonomyPicker/
Observed Behavior
The docs show:
import { ITermInfo, ITermSetInfo, ITermStoreInfo } from "@pnp/sp/taxonomy";
In v4 this subpath does not exist; build fails with:
TS2307: Cannot find module '@pnp/sp/taxonomy' or its corresponding type declarations.
No taxonomy types are published in node_modules/@pnp/sp/ (no taxonomy folder).
Steps to Reproduce
- Create an SPFx web part (v1.21.1)
- Install:
npm install @pnp/sp@4.16.0 @pnp/spfx-controls-react@3.22.0 - Add import for ModernTaxonomyPicker
import { ITermInfo } from "@pnp/sp/taxonomy";
Workaround
Define a declaration:
declare module "@pnp/sp/taxonomy" {
export interface ITermInfoLabel {
name: string;
isDefault: boolean;
languageTag: string;
}
export interface ITermInfoAvailability {
setId: string;
isAvailable: boolean;
}
export interface ITermInfoProperty {
key: string;
value: string;
}
export interface ITermInfoLocalProperty extends ITermInfoProperty {}
export interface ITermInfoDescription {
languageTag: string;
description: string;
}
export interface ITermInfo {
id: string;
labels: ITermInfoLabel[];
name?: string;
path?: string;
childrenCount?: number;
createdDateTime?: string;
lastModifiedDateTime?: string;
isDeprecated?: boolean;
isAvailableForTagging?: ITermInfoAvailability[];
properties?: ITermInfoProperty[];
localProperties?: ITermInfoLocalProperty[];
descriptions?: ITermInfoDescription[];
customSortOrder?: string;
topicRequested?: boolean;
}
}
Metadata
Metadata
Assignees
Labels
No labels