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

Type safety breaks around Dates and other non standard objects when using server functions #2693

Closed
AlexGaudon opened this issue Nov 2, 2024 · 4 comments · Fixed by #2809
Labels
start Everything about TanStack Start types Changes to the typescript types

Comments

@AlexGaudon
Copy link
Contributor

Which project does this relate to?

Start

Describe the bug

Start Server Functions don't respect TanStack Router specified transformers.

See pictures below:

SuperJSON is specified
Image

Function returns a Date, with the proper type
Image

Loader gets the incorrect type (the actual value is just a stringified date)
Image

Your Example Website or App

https://github.com/AlexGaudon/start-date-repro

Steps to Reproduce the Bug or Issue

  1. Clone the repo
  2. Run bun install
  3. Run bun --bun run dev
  4. Navigate to http://localhost:3000 and observe the error

Expected behavior

As a user, I expect server functions to automatically conform to the transformer specified.

Screenshots or Videos

No response

Platform

  • OS: macOs
  • Browser: Chrome + FireFox
  • Version: latest

Additional context

No response

@aretrace
Copy link

aretrace commented Nov 2, 2024

I think a future test suite with various serializers (e.g., Rich-Harris/devalue) would be a good idea.

@SeanCassiere
Copy link
Member

This should be getting addressed in the server functions PR.

@SeanCassiere SeanCassiere added the start Everything about TanStack Start label Nov 2, 2024
@AlexGaudon
Copy link
Contributor Author

Just for clarity, are you talking about #2513

@SeanCassiere
Copy link
Member

SeanCassiere commented Nov 15, 2024

Added onto the backlog for Start related tasks.

This is working during runtime, but types need to be fixed.

Image

@SeanCassiere SeanCassiere added the types Changes to the typescript types label Nov 15, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in Router/Start Roadmap Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
start Everything about TanStack Start types Changes to the typescript types
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants