Repository navigation
Support ComponentMaps in XP 7.13
- Some new files will now be generated:
- /site/layout/index.d.ts
- /site/pages/index.d.ts
- /site/parts/index.d.ts
- These files re-exports the types. So you can now write
import type { ArticleList, EmployeeList } from "/site/parts"; - The new file also declares some global interfaces:
XpPartMap,XpLayoutMapandXpPageMap. The@enonic-typeslibraries after 7.13 will use these interfaces to automatically generate Component-trees that the developer can traverse when doinggetComponent()orgetComponent()?.page?.... The developer can now do if-statements againstcomponent.typeandcomponent.descriptor, and will get the correct shape incomponent.config. - This library doesn't generate
export interface Article { ... }anymore, but instead generatesexport type Article = { ... }. The reason is thatinterface Articlewould not extendRecord<string, unknown>, since interfaces can be expanded by 3rd party code (read project code), TypeScript could not guarantee that the key would be astring. By making this atypeinstead we lock down the shape, and can useRecord<string, unknown>to constrain the shape.
Full Changelog: 2.2.2...2.3.0