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

fix: typescript error TS2344 in fast-foundation.d.ts with TypeScript 4.8.2 #6365

Closed
jedwards1211 opened this issue Sep 8, 2022 · 5 comments
Labels
area:fast-foundation Pertains to fast-foundation bug A bug closed:obsolete No longer valid status:needs-investigation Needs additional investigation

Comments

@jedwards1211
Copy link

🐛 Bug Report

Starting with TypeScript 4.8.2 there are errors like

node_modules/.pnpm/@microsoft+fast-foundation@2.46.14/node_modules/@microsoft/fast-foundation/dist/fast-foundation.d.ts:2252:66 - error TS2344: Type 'T' does not satisfy the constraint 'string | number | boolean | symbol | any[] | Uint8Array | ({ createCSS?(): string; } & Record<PropertyKey, any>) | null'.
  Type 'T' is not assignable to type '{ createCSS?(): string; } & Record<PropertyKey, any>'.
    Type 'T' is not assignable to type '{ createCSS?(): string; }'.

2252 declare function create<T>(nameOrConfig: string): CSSDesignToken<T>;

  node_modules/.pnpm/@microsoft+fast-foundation@2.46.14/node_modules/@microsoft/fast-foundation/dist/fast-foundation.d.ts:2252:25
    2252 declare function create<T>(nameOrConfig: string): CSSDesignToken<T>;
                                 ~
    This type parameter might need an `extends { createCSS?(): string; }` constraint.
  node_modules/.pnpm/@microsoft+fast-foundation@2.46.14/node_modules/@microsoft/fast-foundation/dist/fast-foundation.d.ts:2252:25
    2252 declare function create<T>(nameOrConfig: string): CSSDesignToken<T>;
                                 ~
    This type parameter might need an `extends { createCSS?(): string; } & Record<PropertyKey, any>` constraint.
  node_modules/.pnpm/@microsoft+fast-foundation@2.46.14/node_modules/@microsoft/fast-foundation/dist/fast-foundation.d.ts:2252:25
    2252 declare function create<T>(nameOrConfig: string): CSSDesignToken<T>;
                                 ~
    This type parameter might need an `extends string | number | boolean | symbol | any[] | Uint8Array | ({ createCSS?(): string; } & Record<PropertyKey, any>) | null` constraint.

CSSDesignToken is declared as

export declare interface CSSDesignToken<T extends string | number | boolean | BigInteger | null | Array<any> | symbol | ({
    createCSS?(): string;
} & Record<PropertyKey, any>)> extends DesignToken<T>, CSSDirective {

💻 Repro or Code Sample

TS Playground Example of the error

🌍 Your Environment

TypeScript 4.8.2

@jedwards1211 jedwards1211 added the status:triage New Issue - needs triage label Sep 8, 2022
@EisenbergEffect EisenbergEffect added bug A bug status:needs-investigation Needs additional investigation area:fast-foundation Pertains to fast-foundation labels Sep 8, 2022
@EisenbergEffect EisenbergEffect added this to the FAST Foundation 3.0 milestone Sep 8, 2022
@EisenbergEffect EisenbergEffect removed the status:triage New Issue - needs triage label Sep 8, 2022
@TrevorKarjanis
Copy link

TrevorKarjanis commented Nov 3, 2022

[Edit] Never mind, I also experienced this with 4.8. skipLibCheck resolves the issue if necessary.

This was referenced Nov 8, 2022
@chrisdholt
Copy link
Member

Thanks for confirming the issue beginning in 4.8!

rajsite added a commit to ni/nimble that referenced this issue Jan 30, 2023
# Pull Request

## 🤨 Rationale

Updates our dependencies and devDependencies for all packages. The
intention is to not introduce any breaking changes and relying on tests
+ storybook for that.

Also adds a size to the storybook landing page image to fix #943 (we are
on the latest MDX2 now which is what changed for StoryBook 7 so I don't
think it's gonna change anything else related to MDX significantly).

Updates to the latest Angular 14 (but not up to 15).
Does not update TypeScript past 4.6:
- upgrading to 4.7 isn't required by anything and all our existing apps
are on 4.6, so didn't seem worth including in this PR. Maybe a follow-up
if it works without errors. Typescript 4.7 is needed for package
[import/export
support](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html#packagejson-exports-imports-and-self-referencing).
- upgrading to 4.8 is desired as it is the minimum required by Angular
15 but is not supported by fast:
microsoft/fast#6365
- upgrading to 4.9 is not supported by Angular 14, Angular 15.1 is the
[first version to support
4.9](angular/angular@dd42974)

## 👩‍💻 Implementation

Result of `npm outdated` after changes:
```
Package                                  Current         Wanted         Latest  Location                                        Depended by
@angular-devkit/build-angular            14.2.10        14.2.10         15.1.3  node_modules/@angular-devkit/build-angular      angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/animations                      14.2.12        14.2.12         15.1.2  node_modules/@angular/animations                angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/cli                             14.2.10        14.2.10         15.1.3  node_modules/@angular/cli                       angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/common                          14.2.12        14.2.12         15.1.2  node_modules/@angular/common                    angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/common                          14.2.12        14.2.12         15.1.2  node_modules/@angular/common                    nimble-angular@npm:@ni/nimble-angular@16.0.3
@angular/compiler                        14.2.12        14.2.12         15.1.2  node_modules/@angular/compiler                  angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/compiler-cli                    14.2.12        14.2.12         15.1.2  node_modules/@angular/compiler-cli              angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/core                            14.2.12        14.2.12         15.1.2  node_modules/@angular/core                      angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/core                            14.2.12        14.2.12         15.1.2  node_modules/@angular/core                      nimble-angular@npm:@ni/nimble-angular@16.0.3
@angular/forms                           14.2.12        14.2.12         15.1.2  node_modules/@angular/forms                     angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/forms                           14.2.12        14.2.12         15.1.2  node_modules/@angular/forms                     nimble-angular@npm:@ni/nimble-angular@16.0.3
@angular/platform-browser                14.2.12        14.2.12         15.1.2  node_modules/@angular/platform-browser          angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/platform-browser-dynamic        14.2.12        14.2.12         15.1.2  node_modules/@angular/platform-browser-dynamic  angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/router                          14.2.12        14.2.12         15.1.2  node_modules/@angular/router                    angular-workspace@npm:@ni-private/angular-workspace@1.0.0
@angular/router                          14.2.12        14.2.12         15.1.2  node_modules/@angular/router                    nimble-angular@npm:@ni/nimble-angular@16.0.3
@tanstack/virtual-core             3.0.0-beta.41  3.0.0-beta.41  3.0.0-alpha.1  node_modules/@tanstack/virtual-core             nimble-components@npm:@ni/nimble-components@18.0.3
ng-packagr                                14.2.2         14.2.2         15.1.1  node_modules/ng-packagr                         angular-workspace@npm:@ni-private/angular-workspace@1.0.0
typescript                                 4.6.4          4.6.4          4.9.4  node_modules/typescript                         xliff-to-json-converter@npm:@ni/xliff-to-json-converter@1.1.0
typescript                                 4.6.4          4.6.4          4.9.4  node_modules/typescript                         nimble-tokens@npm:@ni/nimble-tokens@4.3.2
typescript                                 4.6.4          4.6.4          4.9.4  node_modules/typescript                         nimble-components@npm:@ni/nimble-components@18.0.3
typescript                                 4.6.4          4.6.4          4.9.4  node_modules/typescript                         angular-workspace@npm:@ni-private/angular-workspace@1.0.0
typescript                                 4.6.4          4.6.4          4.9.4  node_modules/typescript                         site@npm:@ni-private/site@1.0.0
zone.js                                   0.11.8         0.11.8         0.12.0  node_modules/zone.js                            angular-workspace@npm:@ni-private/angular-workspace@1.0.0
```


## 🧪 Testing

Rely on CI and chromatic

## ✅ Checklist

- [x] I have updated the project documentation to reflect my changes or
determined no changes are needed.
@rajsite
Copy link

rajsite commented Oct 11, 2023

@jedwards1211 this issue should now be resolved with merging of #6779 and release @microsoft/fast-foundation@2.49.2

@rajsite
Copy link

rajsite commented Oct 16, 2023

@chrisdholt we've been having good success with the changes from #6779 so I think that resolves this issue, i.e. fixed in @microsoft/fast-foundation@2.49.2

@janechu janechu removed this from the FAST Foundation 3.0 milestone May 28, 2024
@janechu
Copy link
Collaborator

janechu commented May 29, 2024

Unfortunately @microsoft/fast-foundation is being deprecated, refer to #6955.

@janechu janechu closed this as completed May 29, 2024
@janechu janechu added the closed:obsolete No longer valid label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:fast-foundation Pertains to fast-foundation bug A bug closed:obsolete No longer valid status:needs-investigation Needs additional investigation
Projects
Status: Done
Development

No branches or pull requests

6 participants