-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
FIX types in api package #7072
FIX types in api package #7072
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-fork-dgreuel-api-versions-fix-types.storybook.now.sh |
@ndelangen Is this the correct fix? Or is it better to modify the calling code to accept null/undefined values for these fields? (I suspect it IS better since AFAIK those values can be null!) |
I'm not sure right now, but I think those values can be |
Yeah, it looks like my quick and dirty fix broke the build since those values can be undefined in other places. (I’m not too familiar with the codebase...) |
What about something like this: // extract two interfaces:
export interface UnknownEntries { // (1)
[key: string]: {
[key: string]: any;
};
}
export interface Versions { // (2)
latest?: Version;
next?: Version;
current?: Version;
}
// replace with intersection type:
export interface SubState {
versions: Versions&UnknownEntries; // <-- previously (1) and (2)
lastVersionCheck: number;
dismissedVersionNotification: undefined | string;
} |
The @types will need to be dependencies (not devDependencies) so that downstream typescript users will install the types packages that are required transitively. |
@rosskevin do you recon that's the only thing we need to do to resolve the issue? Which dependencies would need to change from devdependencies to dependencies? This will add some bloat to the node_modules of non-typescript users :( |
@ndelangen I suspect @adamdoyle's code above plus I do not consider the types package bloat - I would really like to change that perception. It is a necessary part of the runtime ( |
@rosskevin consider me convinced |
Any idea of an ETA on this bug fix? Judging by the comments it's close, but there are build issues? |
Issue: #7069
After installing the contexts addon to my TypeScript project, I was unable to run Storybook due to the following errors:
What I did
I'm not sure why the @reach/router and react-syntax-highlighter types were missing, but I got rid of those errors by adding them to my own devDependencies:
I got rid of the TS2411 errors with the changes made in this PR.