Untitled
unknown
plain_text
a year ago
832 B
10
Indexable
mam config
type Components = "Alert" | "Button" | "Input"
type Config = {
path: string;
status?: "Available in NPM" | "Not available in NPM";
};
export const storiesConfig: Record<Uncapitalize<Components>, Config> = {
alert: {
path: "Data Display/Alert",
status: "Available in NPM",
},
button: {
path: "Data Display/Button",
status: "Available in NPM",
},
input: {
path: "Data Display/Input",
status: "Not available in NPM",
},
}
const getPath = (component: Components) => {
return storiesConfig[component].path
}
jak naprawić błąd typescripta w funkcji getPath, błąd jest spowodowany tym że storiesConfig trzyma nazwy komponentów uncapitalized a ja chce przkeazać je capitalized Editor is loading...
Leave a Comment