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.

TypeScript issue with PropertyValue and TS v4.8.2

See original GitHub issue

Bug report

Describe the bug

using PropertyValue for defining a custom util in TypeScript 4.8.2 generates the following typescript error:

TS4118: The type of this node cannot be serialized because its property '[$$PropertyValue]' cannot be serialized.

To Reproduce

I cannot reproduce this in codesandbox because I can’t change the TypeScript version (See: https://github.com/codesandbox/codesandbox-client/issues/942)

  1. Create a react server with typescript 4.8.2
  2. Create stitches config
const stitches = createStitches({
  utils: {
    marginHorizontal: (value: PropertyValue<'margin'>) => ({
      marginLeft: value,
      marginRight: value
    })
  }
});

export const { css, config, createTheme, getCssText, globalCss, keyframes, reset, styled, theme } =
  stitches;
  1. notice the TS error

Expected behavior

I should be able to use PropertyValue on TS 4.8.2

Screenshots

Screen Shot 2022-09-02 at 10 19 26 AM

System information

  • OS: N/A
  • Browser: N/A
  • Version of Node.js: N/A
  • Version of Stitches: 1.2.8
  • Version of TypeScript: 4.8.2

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:14
  • Comments:7

github_iconTop GitHub Comments

5reactions
domcolemancommented, Sep 6, 2022

I’m not sure how many people have this issue experience. I’m on Typescript 4.5.2 and getting the same error, and the error came out from no where.

If you’re using VS Code you can switch to the workspace version of TypeScript, by default it will use VS Code’s version.

Screenshot 2022-09-06 at 10 30 00
0reactions
Andaristcommented, Sep 11, 2022

Since this has changed between 4.7 and 4.8 - is there any TS issue to track this specific regression/change on their side?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript issue with PropertyValue and TS v4.8.2 - PullAnswer
I'm on Typescript 4.5.2 and getting the same error, and the error came out ... The last TS version which doesn't throw errors...
Read more >
4.8.2: Type serialization error with unique symbol #50720
Bug Report Original issue: stitchesjs/stitches#1078 When two types refer to the same unique symbol and they are combined via inference, ...
Read more >
Documentation - TypeScript 4.9
JavaScript's in operator can check whether a property exists on an object. Previously, TypeScript allowed us to narrow away any types that don't...
Read more >
typescript - The property 'value' does not exist on value of type ...
This fix breaks my code entirely; says whatever comes next "is not a function". I don't understand the reasoning behind the way TS...
Read more >
OData Common Schema Definition Language (CSDL) XML ...
https://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/cos01/odata-csdl-xml-v4.01- ... (XML) 1.1 (Second Edition), F. Yergeau, E. Maler, J. Cowan, T. Bray, ...
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