Skip to content

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

@Hotell

Description

@Hotell

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 TS@4.3
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 TS@4.4
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 TS@4.5
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 TS@4.6
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 TS@4.7
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 TS@4.8
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 TS@4.9
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions