question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`useTypedLoaderData` Syntax Error during another Error

See original GitHub issue

Trying to reproduce with a minimal example:

export const loader = async ({
    request,
  }: LoaderArgs): Promise<TypedJsonResponse<LoaderData>> => {
  
    const data = {
      date: new Date()
    };
  
    return typedjson(data);
};


export default function Dashboard(): JSX.Element {
  const loaderData = useTypedLoaderData<typeof loader>();
  const { date } = loaderData;
  // Purposefully throw an error to show issue
  throw new Error("TEST")
  return null;
}

Error message in browser console window:

Uncaught SyntaxError: Unexpected identifier 'Nov'

When checking the file its talking about in Sources tab You’ll see something like this in the file:

'routeData':{'routes/dashboard': {'date':Thu Nov 03 2022 11:04:25 GMT-0400 (Eastern Daylight Time)}}'

Seems like the typedjson is causing syntax errors somewhere due to the type conversions?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jmaldon1commented, Nov 3, 2022

Updated to "@remix-run/dev": "^1.7.5", and i think it fixed it lol

0reactions
jmaldon1commented, Nov 3, 2022

I can’t seem to repro this when I clone this https://github.com/mui/material-ui/tree/master/examples/remix-with-typescript and try to recreate it, which uses emotion and MUI also.

Read more comments on GitHub >

github_iconTop Results From Across the Web

In SQL, is it a syntax error to appoint a different datatype ...
So obviously there's a mistake because the Foreign Key DozentNr is declared as a CHAR, while the Primary Key it references is of...
Read more >
ASA messages
SYNTAX ERROR IN PARMLIB MEMBER=memname LINE line-number: symbol1 EXPECTED BEFORE symbol2. DETECTING MODULE IS detmod. INPUT LINE: input-line; ASA003I
Read more >
Invalid Syntax in Python: Common Reasons for SyntaxError
If you've ever received a SyntaxError when trying to run your Python code, ... The interpreter will attempt to show you where that...
Read more >
How to Handle the Syntax Error in Javascript
The Javascript SyntaxError is thrown when the engine comes across tokens or token orders with incorrect syntax when parsing code.
Read more >
SyntaxError - JavaScript - MDN Web Docs
The SyntaxError object represents an error when trying to interpret syntactically invalid code. It is thrown when the JavaScript engine encounters tokens or ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found