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

0.7.1 or 0.21.3: TS2344: Type 'BaseType' does not satisfy the constraint 'Record<string | number, any>'. #520

Closed
myonara opened this issue Nov 26, 2022 · 1 comment

Comments

@myonara
Copy link

myonara commented Nov 26, 2022

Two errors in a fresh angular 15.0.1/aws-amplify 5.0.4 project:

Error: node_modules/type-fest/ts41/get.d.ts:93:37 - error TS2344: Type 'BaseType' does not satisfy the constraint 'Record<string | number, any>'.
93  : Key extends keyof WithStringKeys<BaseType>
                                       ~~~~~~~~
  node_modules/type-fest/ts41/get.d.ts:79:17
    79 type PropertyOf<BaseType, Key extends string> =
                      ~~~~~~~~
    This type parameter might need an `extends Record<string | number, any>` constraint.
Error: node_modules/type-fest/ts41/get.d.ts:94:19 - error TS2344: Type 'BaseType' does not satisfy the constraint 'Record<string | number, any>'.
94  ? WithStringKeys<BaseType>[Key]
                     ~~~~~~~~
  node_modules/type-fest/ts41/get.d.ts:79:17
    79 type PropertyOf<BaseType, Key extends string> =
                       ~~~~~~~~
    This type parameter might need an `extends Record<string | number, any>` constraint.

Reproduce this issue:

npm install -g @angular/cli@15.0.1
npm install -g @aws-amplify/cli@10.5.1
amplify configure
ng new testing-type-fest
cd testing-type-fest/
amplify init
npm install --save aws-amplify @aws-amplify/ui-angular
amplify add auth
ng build

Maybe the amplify statements are optional, please try.

Sections from the package-log.json (versions and dependants):

    "node_modules/ansi-escapes": {
      "version": "4.3.2",
      "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
      "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",
      "dev": true,
      "dependencies": {
        "type-fest": "^0.21.3"
      },
      "engines": {
        "node": ">=8"
      },
    "node_modules/stacktrace-parser/node_modules/type-fest": {
      "version": "0.7.1",
      "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz",
      "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==",
      "peer": true,
      "engines": {
        "node": ">=8"
      }
    },

    "node_modules/type-fest": {
      "version": "0.21.3",
      "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
      "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
      "dev": true,
      "engines": {
        "node": ">=10"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },

Questions

Is there a workaround (e.g. switching off the error in tsconfig.json?)

  • YES:, but only until it is fixed, as a lot of type errors will be suppressed
  "compilerOptions": {
    "skipLibCheck": true,

where is that fixed, stacktrack-parser and/or ansi-escapes can fix this?

@myonara myonara changed the title 0.21.3: TS2344: Type 'BaseType' does not satisfy the constraint 'Record<string | number, any>'. 0.7.1 or 0.21.3: TS2344: Type 'BaseType' does not satisfy the constraint 'Record<string | number, any>'. Nov 26, 2022
@sindresorhus
Copy link
Owner

You're on an old version of type-fest. I believe this has been fixed in later versions.

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants