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

Packages should define what minbar TypeScript is supported #19537

Closed
dzearing opened this issue Aug 26, 2021 · 1 comment
Closed

Packages should define what minbar TypeScript is supported #19537

dzearing opened this issue Aug 26, 2021 · 1 comment
Labels
Area: Build System Area: Typescript Resolution: Soft Close Soft closing inactive issues over a certain period

Comments

@dzearing
Copy link
Member

dzearing commented Aug 26, 2021

Problem:

Customer uses TypeScript 3.7 with Fluent UI and starts getting syntax errors because TypeScript doesn't recognize newer syntaxes in d.ts files.

Proposed solution (one of many possibly):

In package.json for each package, specify types as unsupported.d.ts. Additionally use typesVersions entry to specify the minbar TypeScript version:

{
  "types": "unsupported-typescript-version.d.ts",
  "typesVersions": {
    ">3.9": "lib/index.d.ts"
  }
}

See documentation here: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#version-selection-with-typesversions

Versions which don't resolve typings in typesVersions will fail to pick up typings, which is a better error than random syntax errors in various places.

Tools can also use the typesVersions entries to make decisions; for example, my recent codemod work of moving to import type syntax could special case packages that support < TS 3.9 if this information were programmatically accessible from the package definition.

Alternative solution:

Use typesVersions to redirect older versions to unsupported.d.ts. This will work most of the time, and maybe require less modifications in the future. This will work with TypeScript 3.1 and newer, but for older versions than that it won't be respected while the suggested solution should work for very very old versions.

@msft-fluent-ui-bot
Copy link
Collaborator

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft microsoft locked as resolved and limited conversation to collaborators Mar 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Build System Area: Typescript Resolution: Soft Close Soft closing inactive issues over a certain period
Projects
None yet
Development

No branches or pull requests

4 participants