composeRestyleFunctions not accepting `border`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react-native, typescript
- Lĩnh vực
- frontend, mobile-dev
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 3.4k
- Fork
- 154
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Shopify/restyle
-
Reanimated 4.4.x animated components conflict with Restyle themeCó thể đã có người làm @KAMRONBEK đã nhận 131 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 15/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
-
Cannot make custom componentĐang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Tất cả issue của Shopify/restyle
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
testing-library/jest-dom#749 ·
-
Duplicate "./pack-settings" export in packages/workflows/package.json makes `bun install` failĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
zed-industries/delta-claude#50 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CDLUC3/dmptool-doc#660 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
stripe/stripe-terminal-react-native#1162 ·
Maintainer thường phản hồi trong vòng 1 ngày