-
Notifications
You must be signed in to change notification settings - Fork 2
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
Convert to TypeScript / Add storybook #68
Conversation
"@storybook/storybook-deployer": "^2.8.5", | ||
"@storybook/web-components": "7.6.17", | ||
"@types/mocha": "^10.0.6", | ||
"@web/storybook-builder": "^0.1.9", |
There was a problem hiding this comment.
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?
src/cosmoz-treenode.ts
Outdated
@@ -111,7 +142,7 @@ export const computePathToRender = (path, hideFromRoot, showMaxNodes) => { | |||
ownerTree, | |||
ellipsis = '… / ', | |||
fallback, | |||
}) => { | |||
}: TreenodeType) => { |
There was a problem hiding this comment.
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
.
src/cosmoz-treenode.ts
Outdated
|
||
export const computePathToRender = (path, hideFromRoot, showMaxNodes) => { | ||
export type ComputePathTextType = { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
export type ComputePathTextType = { | |
export interface ComputePathText extends Pick<Props, 'ownerTree'|'ellipsis'| ...> { | |
// add here own props that aren't the same | |
pathToRender?: string | |
} |
src/cosmoz-treenode.ts
Outdated
text: string; | ||
}; | ||
|
||
export type TreenodeType = { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
Create it using treeJson loader
in favor of #69 |
No description provided.