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

Error: Property 'data' does not exist on type 'never #643

Open
AgnaldoCordeiro opened this issue Jan 4, 2025 · 0 comments
Open

Error: Property 'data' does not exist on type 'never #643

AgnaldoCordeiro opened this issue Jan 4, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@AgnaldoCordeiro
Copy link

Problem Description:

When running the build command using yarn build (which executes faststore build), the following type error occurs:

./src/components/sections/ProductGallery/ProductGallery.tsx:42:17
Type error: Property 'data' does not exist on type 'never'.

40 | ? [context?.data?.title, context?.data?.searchTerm]
41 | : isPLP(context)

42 | ? [context?.data?.collection?.seo?.title]
| ^
43 | : ['']
44 |

Steps to Reproduce the Issue:

Clone the base repository (FastStore starter).
Run the yarn build command.
The build process fails with the above error.
Expected Behavior: The build process should complete successfully without errors.

Current Behavior: A type error occurs in ProductGallery.tsx.

Possible Causes:

The issue seems related to the context type (usePage()) returned to the component.
Specifically, the context type in usePage might be missing or inferred as never due to unclear definitions or conflicting types in the project.
Attempts to Solve:

Temporarily setting the type to any resolves the issue but is not an ideal solution.
Reviewed the PageProvider and type guard functions like isPLP, isPDP, and isSearchPage.
Additional Information:

The issue appears to stem from type definitions in the PageProvider and ProductGallery files.
Please let me know if further details or testing are needed. Thank you!

@AgnaldoCordeiro AgnaldoCordeiro added the bug Something isn't working label Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant