composeRestyleFunctions not accepting `border`
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- react-native, typescript
- 领域
- frontend, mobile-dev
调研方向
Start with src/Button.tsx and the custom-components example linked in the issue, then reproduce the TypeScript declaration build using @shopify/restyle ^2.4.4. Trace the type errors around composeRestyleFunctions and the missing borderRadius export; done means the documented border setup compiles without the reported errors.
由索引模型根据 Issue 内容生成。
描述
Current behavior
I am creating custom component using composeRestyleFunctions i am using the example provided in doc https://shopify.github.io/restyle/fundamentals/components/custom-components/
Code i am using:
const restyleFunctions = composeRestyleFunctions<Theme, RestyleProps>([
spacing,
border,
backgroundColor,
createVariant({ themeKey: 'buttonVariants' }),
]);
In above code i am getting following typescript error:
@acme/ui:dev: RollupError: Failed to compile. Check the logs above.
@acme/ui:dev: at error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:210:30)
@acme/ui:dev: at Object.error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:23975:20)
@acme/ui:dev: at Object.error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:23220:42)
@acme/ui:dev: at Object.transform (/Users/vivex/expo-monorepo-example/node_modules/tsup/dist/rollup.js:7287:20)
@acme/ui:dev: at /Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:24176:40
@acme/ui:dev: src/Button.tsx(26,3): error TS2322: Type '({ property: "borderStyle" | "borderBottomWidth" | "borderEndWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStartWidth" | "borderTopWidth" | "borderWidth"; themeKey: undefined; variant: boolean; func: RestyleFunction<...>; } | { ...; } | { ...; })[]' is not assignable to type 'RestyleFunctionContainer<RestyleProps, { colors: { mainBackground: string; cardPrimaryBackground: string; primary: string; }; spacing: { xs: number; s: number; m: number; l: number; xl: number; }; textVariants: { ...; }; cardVariants: { ...; }; buttonVariants: { ...; }; }, "marginVertical" | ... 45 more ... | "varia...'.
@acme/ui:dev: Type '({ property: "borderStyle" | "borderBottomWidth" | "borderEndWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStartWidth" | "borderTopWidth" | "borderWidth"; themeKey: undefined; variant: boolean; func: RestyleFunction<...>; } | { ...; } | { ...; })[]' is not assignable to type 'RestyleFunctionContainer<RestyleProps, { colors: { mainBackground: string; cardPrimaryBackground: string; primary: string; }; spacing: { xs: number; s: number; m: number; l: number; xl: number; }; textVariants: { ...; }; cardVariants: { ...; }; buttonVariants: { ...; }; }, "marginVertical" | ... 45 more ... | "varia...'.
@acme/ui:dev: Type '{ property: "borderStyle" | "borderBottomWidth" | "borderEndWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStartWidth" | "borderTopWidth" | "borderWidth"; themeKey: undefined; variant: boolean; func: RestyleFunction<...>; } | { ...; } | { ...; }' is not assignable to type 'RestyleFunctionContainer<RestyleProps, { colors: { mainBackground: string; cardPrimaryBackground: string; primary: string; }; spacing: { xs: number; s: number; m: number; l: number; xl: number; }; textVariants: { ...; }; cardVariants: { ...; }; buttonVariants: { ...; }; }, "marginVertical" | ... 45 more ... | "varia...'.
@acme/ui:dev: Type '{ property: "borderBottomEndRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStartRadius" | "borderRadius" | "borderTopEndRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStartRadius"; themeKey: "borderRadii" | undefined; variant: boolean; func: RestyleFunction<...>; }' is not assignable to type 'RestyleFunctionContainer<RestyleProps, { colors: { mainBackground: string; cardPrimaryBackground: string; primary: string; }; spacing: { xs: number; s: number; m: number; l: number; xl: number; }; textVariants: { ...; }; cardVariants: { ...; }; buttonVariants: { ...; }; }, "marginVertical" | ... 45 more ... | "varia...'.
@acme/ui:dev: Types of property 'themeKey' are incompatible.
@acme/ui:dev: Type '"borderRadii" | undefined' is not assignable to type '"textVariants" | "spacing" | "colors" | "cardVariants" | "buttonVariants" | undefined'.
@acme/ui:dev: Type '"borderRadii"' is not assignable to type '"textVariants" | "spacing" | "colors" | "cardVariants" | "buttonVariants" | undefined'.
@acme/ui:dev:
@acme/ui:dev: DTS Build failed
@acme/ui:dev: RollupError: Failed to compile. Check the logs above.
@acme/ui:dev: at error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:210:30)
@acme/ui:dev: at Object.error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:23975:20)
@acme/ui:dev: at Object.error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:23220:42)
@acme/ui:dev: at Object.transform (/Users/vivex/expo-monorepo-example/node_modules/tsup/dist/rollup.js:7287:20)
@acme/ui:dev: at /Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:24176:40
@acme/ui:dev: src/Button.tsx(26,3): error TS2322: Type '({ property: "borderStyle" | "borderBottomWidth" | "borderEndWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStartWidth" | "borderTopWidth" | "borderWidth"; themeKey: undefined; variant: boolean; func: RestyleFunction<...>; } | { ...; } | { ...; })[]' is not assignable to type 'RestyleFunctionContainer<RestyleProps, { colors: { mainBackground: string; cardPrimaryBackground: string; primary: string; }; spacing: { xs: number; s: number; m: number; l: number; xl: number; }; textVariants: { ...; }; cardVariants: { ...; }; buttonVariants: { ...; }; }, "marginVertical" | ... 45 more ... | "varia...'.
@acme/ui:dev: Type '({ property: "borderStyle" | "borderBottomWidth" | "borderEndWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStartWidth" | "borderTopWidth" | "borderWidth"; themeKey: undefined; variant: boolean; func: RestyleFunction<...>; } | { ...; } | { ...; })[]' is not assignable to type 'RestyleFunctionContainer<RestyleProps, { colors: { mainBackground: string; cardPrimaryBackground: string; primary: string; }; spacing: { xs: number; s: number; m: number; l: number; xl: number; }; textVariants: { ...; }; cardVariants: { ...; }; buttonVariants: { ...; }; }, "marginVertical" | ... 45 more ... | "varia...'.
@acme/ui:dev: Type '{ property: "borderStyle" | "borderBottomWidth" | "borderEndWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStartWidth" | "borderTopWidth" | "borderWidth"; themeKey: undefined; variant: boolean; func: RestyleFunction<...>; } | { ...; } | { ...; }' is not assignable to type 'RestyleFunctionContainer<RestyleProps, { colors: { mainBackground: string; cardPrimaryBackground: string; primary: string; }; spacing: { xs: number; s: number; m: number; l: number; xl: number; }; textVariants: { ...; }; cardVariants: { ...; }; buttonVariants: { ...; }; }, "marginVertical" | ... 45 more ... | "varia...'.
@acme/ui:dev: Type '{ property: "borderBottomEndRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStartRadius" | "borderRadius" | "borderTopEndRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStartRadius"; themeKey: "borderRadii" | undefined; variant: boolean; func: RestyleFunction<...>; }' is not assignable to type 'RestyleFunctionContainer<RestyleProps, { colors: { mainBackground: string; cardPrimaryBackground: string; primary: string; }; spacing: { xs: number; s: number; m: number; l: number; xl: number; }; textVariants: { ...; }; cardVariants: { ...; }; buttonVariants: { ...; }; }, "marginVertical" | ... 45 more ... | "varia...'.
@acme/ui:dev: Types of property 'themeKey' are incompatible.
@acme/ui:dev: Type '"borderRadii" | undefined' is not assignable to type '"textVariants" | "spacing" | "colors" | "cardVariants" | "buttonVariants" | undefined'.
@acme/ui:dev: Type '"borderRadii"' is not assignable to type '"textVariants" | "spacing" | "colors" | "cardVariants" | "buttonVariants" | undefined'.
@acme/ui:dev:
@acme/ui:dev: DTS Build failed
@acme/ui:dev: RollupError: Failed to compile. Check the logs above.
@acme/ui:dev: at error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:210:30)
@acme/ui:dev: at Object.error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:23975:20)
@acme/ui:dev: at Object.error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:23220:42)
@acme/ui:dev: at Object.transform (/Users/vivex/expo-monorepo-example/node_modules/tsup/dist/rollup.js:7287:20)
@acme/ui:dev: at /Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:24176:40
@acme/ui:dev: src/Button.tsx(4,3): error TS2305: Module '"@shopify/restyle"' has no exported member 'borderRadius'.
@acme/ui:dev:
@acme/ui:dev: DTS Build failed
@acme/ui:dev: RollupError: Failed to compile. Check the logs above.
@acme/ui:dev: at error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:210:30)
@acme/ui:dev: at Object.error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:23975:20)
@acme/ui:dev: at Object.error (/Users/vivex/expo-monorepo-example/node_modules/rollup/dist/shared/rollup.js:23220:42)
@acme/ui:dev: at Object.transform (/Users/vivex/expo-monorepo-example/node_modules/tsup/dist/rollup.js:7287:20)```
## Expected behavior
## To Reproduce
Following example from https://shopify.github.io/restyle/fundamentals/components/custom-components/
## Platform:
- [ ] iOS
## Environment
^2.4.4
- 主要语言
- TypeScript
- 星标
- 3.4k
- 派生
- 154
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Shopify/restyle 的其他 Issue
-
Reanimated 4.4.x animated components conflict with Restyle theme可能已有人在做 @KAMRONBEK 于 131 天前认领。 未关闭bug
难度 3/5 1-2 天 新手友好度 55/100
-
bug
难度 3/5 1-2 天 新手友好度 35/100
-
bug
难度 1/5 1 小时以内 新手友好度 15/100
-
bug
难度 3/5 1-2 天 新手友好度 25/100
-
bug
难度 3/5 1-2 天 新手友好度 35/100
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 75/100
testing-library/jest-dom#749 ·
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
zed-industries/delta-claude#50 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
CDLUC3/dmptool-doc#660 ·
-
难度 1/5 1 小时以内 新手友好度 72/100
stripe/stripe-terminal-react-native#1162 ·
维护者通常 1 天内回复