-
Notifications
You must be signed in to change notification settings - Fork 5
update typescript and fix deprecation warnings #12
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
base: next
Are you sure you want to change the base?
Conversation
update typescript and fix deprecation warnings
|
not good: @onigoetz would you be interested in helping figuring our what is causing these changes? Here's my PR to storybook upgrading it to this canary: storybookjs/storybook#23040 note that storybook was using |
|
Hi, yes I'll try to have a look |
|
Sorry for the delay ... I had a look and found some surprising things so far : The snapshot you posted ( https://www.chromatic.com/test?appId=62f0fd349c07f78d10b7c017&id=64883ef76692a9984c1a89d6 ) got me to find this code : https://github.com/storybookjs/storybook/blob/0eaaa8ccbebc446364019820669aba87444a95a3/code/renderers/react/template/stories/docgen-components/9493-ts-display-name/input.tsx I added it to the plugin's fixtures and got the following result in the snapshot: I spot two issues here:
I made some experiments by importing the library in various versions and generating the code and can't find a version of the library that doesn't have this behaviour, including the For the empty props issue though, changing the component to a function component yielded the following: Interestingly, this shows the default value, the possible values aren't resolved either. I will check how the upstream |
|
Digging the topic a bit further, I found that by
- export const EmpireAlert: React.FC<EmpireAlertProps> = ({
+ export const EmpireAlert = ({The generated docgen is now SomeOtherDisplayName.__docgenInfo = {
description:
"This message should show up in the Docs panel if everything works fine.",
displayName: "SomeOtherDisplayName",
props: {
title: {
defaultValue: { value: "Code Yellow" },
description: "A title that brings attention to the alert.",
name: "title",
required: false,
type: {
name: "enum",
value: [
{ value: '"Code Red"' },
{ value: '"Code Yellow"' },
{ value: '"Code Green"' },
],
},
},
message: {
defaultValue: null,
description: "A message alerting about Empire activities.",
name: "message",
required: true,
type: { name: "string" },
},
},
};The assignment is still incorrect, but the types content is now resolved properly. As a side effect, many other snapshots have more detailed types than they did before |
Replaces: #8
Testing in ecosystem: storybookjs/storybook#23040
📦 Published PR as canary version:
1.0.2--canary.12.cf35881ff63bf958b8998e8dd1dfd5626ee868c2.0✨ Test out this PR locally via:
npm install @storybook/react-docgen-typescript-plugin@1.0.2--canary.12.cf35881ff63bf958b8998e8dd1dfd5626ee868c2.0 # or yarn add @storybook/react-docgen-typescript-plugin@1.0.2--canary.12.cf35881ff63bf958b8998e8dd1dfd5626ee868c2.0