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.

TS 4.4: `exactOptionalPropertyTypes: true` support

See original GitHub issue

TypeScript 4.4’s release is around the corner, and I’m testing it right now. I’m hitting issues with csstype as properties are optional but do not explicitly allow undefined, for example

left?: Property.Left<TLength>;

should be

left?: Property.Left<TLength> | undefined;

https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-rc/

Support for this would be nice.

For reference: https://github.com/adazzle/react-data-grid/pull/2566

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
freniccommented, Nov 15, 2021

Released in 3.0.10

2reactions
freniccommented, Aug 13, 2021

My first thought was that maybe it would be expected to fail so you’re notified when something can be removed. But I guess you’re right. This would be annoying:

let myColor: string | undefined;

if (someCondition) {
  myColor: 'red';
}

const style: CSS.Properties = {
  color: myColor, // Guess this would cause a type error?
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - TypeScript 4.4
Exact Optional Property Types ( --exactOptionalPropertyTypes ). In JavaScript, reading a missing property on an object produces the value undefined . It's also ......
Read more >
Support TypeScript 4.4 exactOptionalPropertyTypes #1919
Typescript 4.4 introduced a new feature, exactOptionalPropertyTypes. The default value is false but the recommended value is true.
Read more >
Announcing TypeScript 4.4 - Microsoft Developer Blogs
Defaulting to the unknown Type in Catch Variables ( --useUnknownInCatchVariables ); Exact Optional Property Types ( --exactOptionalPropertyTypes ) ...
Read more >
Support TypeScript tsconfig flag `exactOptionalPropertyTypes
The flag tsconfig.json:compilerOptions.exactOptionalPropertyTypes set to true is not compatible with the exported types in .d.ts files from @ ...
Read more >
TypeScript 4.4: The Good, The Bad and The Not So Bad
The isString condition wasn't able to let TS know that, when it's true, the arg is a string . As a result, TS...
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