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

[Bug]: react-utilities ships incompatible types for TS version 4.4 - 4.6 #27951

Closed
2 tasks done
Hotell opened this issue May 23, 2023 · 9 comments · Fixed by #27936
Closed
2 tasks done

[Bug]: react-utilities ships incompatible types for TS version 4.4 - 4.6 #27951

Hotell opened this issue May 23, 2023 · 9 comments · Fixed by #27936

Comments

@Hotell
Copy link
Contributor

Hotell commented May 23, 2023

Library

React Components / v9 (@fluentui/react-components)

System Info

na

Are you reporting Accessibility issue?

None

Reproduction

while dts-check tool is not publicly available yet you can do following:

  1. check playground

  2. bump TS to 4.4 within fluent monorepo

  • bump TS version to 4.4 in fluent repo
  • run yarn workspace @fluentui/react-utilities type-check

Bug Description

Actual Behavior

TS 4.4 introduced better lib.d.ts declarations which align/follow stable apis supported by real browsers https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/#breaking-changes. Also new approach of how one can use custom standard lib has been introduced.

This change removed several APIs that were not supported by browsers at time of TS 4.4 release etc. one of those api is DialogElement microsoft/TypeScript-DOM-lib-generator#1029.

Based on fluent browser matrix support we cannot use native Dialog api nor types so it should be removed in order to support users and our codebase to use TS 4.4, 4.5 and 4.6.

Error log:

yarn workspace @fluentui/react-components dts --min 4.3 --max 4.9
yarn workspace v1.23.34
yarn run v1.23.34
$ /Users/martinhochel/Projects/msft/fluentui/node_modules/.bin/dts --min 4.3 --max 4.9
dts:  🧪 Checking declaration files against TS versions - from v4.3 to v4.9

dts:  Checking declarations in /Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-components/dist against [email protected]
dts:  - index.d.ts
dts:  - unstable.d.ts
dts:  ✅ All good

dts:  Checking declarations in /Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-components/dist against [email protected]
dts:  - index.d.ts
dts:  - unstable.d.ts
dts:  ❌ Errors found:
/Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-utilities/dist/index.d.ts(244,29): error TS2344: Type 'typeof globalThis[ConstructorName]' does not satisfy the constraint 'abstract new (...args: any) => any'.
/Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-utilities/dist/index.d.ts(244,29): error TS2536: Type 'ConstructorName' cannot be used to index type 'typeof globalThis'.

dts:  Checking declarations in /Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-components/dist against [email protected]
dts:  - index.d.ts
dts:  - unstable.d.ts
dts:  ❌ Errors found:
error TS4124: Compiler option 'moduleResolution' of value 'nodenext' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-utilities/dist/index.d.ts(244,29): error TS2344: Type 'typeof globalThis[ConstructorName]' does not satisfy the constraint 'abstract new (...args: any) => any'.
/Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-utilities/dist/index.d.ts(244,29): error TS2536: Type 'ConstructorName' cannot be used to index type 'typeof globalThis'.

dts:  Checking declarations in /Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-components/dist against [email protected]
dts:  - index.d.ts
dts:  - unstable.d.ts
dts:  ❌ Errors found:
error TS4124: Compiler option 'moduleResolution' of value 'nodenext' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-utilities/dist/index.d.ts(244,29): error TS2344: Type 'typeof globalThis[ConstructorName]' does not satisfy the constraint 'abstract new (...args: any) => any'.
/Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-utilities/dist/index.d.ts(244,29): error TS2536: Type 'ConstructorName' cannot be used to index type 'typeof globalThis'.

dts:  Checking declarations in /Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-components/dist against [email protected]
dts:  - index.d.ts
dts:  - unstable.d.ts
dts:  ✅ All good

dts:  Checking declarations in /Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-components/dist against [email protected]
dts:  - index.d.ts
dts:  - unstable.d.ts
dts:  ✅ All good

dts:  Checking declarations in /Users/martinhochel/Projects/msft/fluentui/packages/react-components/react-components/dist against [email protected]
dts:  - index.d.ts
dts:  - unstable.d.ts
dts:  ✅ All good

error Command failed with exit code 1.

Expected Behavior

v9 ships valid types for TS 4.4 - 4.6

Logs

No response

Requested priority

Blocking

Products/sites affected

No response

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@Hotell Hotell changed the title [Bug]: react-utilities incompatible types for TS version 4.4,4.5,4.6,4.7 [Bug]: react-utilities incompatible types for TS version 4.4 - 4.6 May 23, 2023
@Hotell Hotell changed the title [Bug]: react-utilities incompatible types for TS version 4.4 - 4.6 [Bug]: react-utilities ships incompatible types for TS version 4.4 - 4.6 May 23, 2023
@bsunderhus
Copy link
Contributor

bsunderhus commented May 23, 2023

Does this example solve this @Hotell? on the playground provided the problem seemed to be the presence of HTMLDialogElement in the union

@msft-fluent-ui-bot
Copy link
Collaborator

🎉This issue was addressed in #27936, which has now been successfully released as @fluentui/[email protected].:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉This issue was addressed in #27936, which has now been successfully released as @fluentui/[email protected].:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉This issue was addressed in #27936, which has now been successfully released as @fluentui/[email protected].:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉This issue was addressed in #27936, which has now been successfully released as @fluentui/[email protected].:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉This issue was addressed in #27936, which has now been successfully released as @fluentui/[email protected].:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉This issue was addressed in #27936, which has now been successfully released as @fluentui/[email protected].:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉This issue was addressed in #27936, which has now been successfully released as @fluentui/[email protected].:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉This issue was addressed in #27936, which has now been successfully released as @fluentui/[email protected].:tada:

Handy links:

@microsoft microsoft locked as resolved and limited conversation to collaborators Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants