fix: init admin typings and scaffold regressions#107
fix: init admin typings and scaffold regressions#107Link2Twenty wants to merge 6 commits intostrapi:mainfrom
Conversation
Signed-off-by: Andrew Bone <AndrewB05@gmail.com>
addMenuLink['Component'] expects
```tsx
() => Promise<{
default: React.ComponentType;
}>;
```
Meaning the component must be the default export
Signed-off-by: Andrew Bone <AndrewB05@gmail.com>
|
- Use the `StrapiAppPlugin` type rather than remaking it - fix registerTrads so it actually transforms languages. Signed-off-by: Andrew Bone <AndrewB05@gmail.com>
|
|
|
Thanks for this! I pushed a change that:
If this looks good to you still, I’m happy to merge! |
Register|
The reason I changed the export to default was because the addMenuLink type expects it to be a default export. As it stands now it will throw and type error. addMenuLink: (link: Omit<MenuItem, 'Component'> & {
Component: () => Promise<{
default: React.ComponentType;
}>;
}) => void;We could fake the import in Component: async () => {
const { App } = await import('./pages/App');
return {default: App};
},But other than that everything looks great. |





What does it do?
Remove the
anyfrom register and update the function so it matches the existing type.One of the changes is to make App a default export, this is simply to make the linter happy and changing the type might be the correct way to go.
Why is it needed?
Types are good
How to test it?
Load the types in and see the linter is happy.
Related issue(s)/PR(s)
N/A
Edit:
I noticed there was already a type the describes this whole export so I've set it up to use that instead.
While I was in there I realised the mapping of translation keys wasn't happening so I've added that in.
Let me know if yo need that to be a send PR.