Skip to content
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

Convert to TypeScript / Add storybook #68

Conversation

florianstancioiu
Copy link

No description provided.

"@storybook/storybook-deployer": "^2.8.5",
"@storybook/web-components": "7.6.17",
"@types/mocha": "^10.0.6",
"@web/storybook-builder": "^0.1.9",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't @web/storybook-builder and @web/storybook-framework-web-components enough ? Do we need to add all the @storybook/* plugin to deps?

@@ -111,7 +142,7 @@ export const computePathToRender = (path, hideFromRoot, showMaxNodes) => {
ownerTree,
ellipsis = '… / ',
fallback,
}) => {
}: TreenodeType) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this i component I'd simply name this Props.


export const computePathToRender = (path, hideFromRoot, showMaxNodes) => {
export type ComputePathTextType = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not include the word Type in a type. We know its a type cause its TS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this uses some properties from Options we can reuse. See https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys

Suggested change
export type ComputePathTextType = {
export interface ComputePathText extends Pick<Props, 'ownerTree'|'ellipsis'| ...> {
// add here own props that aren't the same
pathToRender?: string
}

text: string;
};

export type TreenodeType = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Props


export const computePathToRender = (
path?: string,
hideFromRoot?: number,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hideFromRoot and showMaxNodes can't be optional.
path also can't be optional but you can make it string|undefined.

@megheaiulian
Copy link
Contributor

in favor of #69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants