amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Error: @aws-amplify/datastore/lib-esm/types.d.ts- error TS2536: Type '"field"' cannot be used to index type ...

Open brianreinhold opened this issue 5 months ago • 3 comments

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

20.9.0

Amplify CLI Version

running aws-amplify 5.3.12 in Angular 18

What operating system are you using?

Windows 10

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

no

Describe the bug

Was using aws-amplify 5.3.12 with Angular 17. No problem. Updated to Angular 18, Updated aws-amplify to the latest version 5 which is 5.3.23. Tried to build and serve by running ng serve. Everything worked except for 3 errors in aws-amplify's @aws-amplify/datastore/lib-esm/types.d.ts file. All three errors were of the same type

Error: node_modules/@aws-amplify/datastore/lib-esm/types.d.ts:252:371 - error TS2536: Type '"field"' cannot be used to index type 'MetadataOrDefault<T, M>["identifier"]'..
Error: node_modules/@aws-amplify/datastore/lib-esm/types.d.ts:301:313 - error TS2536: Type 'MetadataOrDefault<T, M>["identifier"]["field"]' cannot be used to index type 'T'.
Error: node_modules/@aws-amplify/datastore/lib-esm/types.d.ts:301:315 - error TS2536: Type '"field"' cannot be used to index type 'MetadataOrDefault<T, M>["identifier"]'.

Expected behavior

No errors

Reproduction steps

Use aws-amplify version 5.* in an Angular 18 application.

Project Identifier

the given command does not work.

Log output

# Put your logs below this line


Additional information

Workaround: Add "skipLibCheck": true,

to the ts.config file's compiler options

Cost: Type checking is skipped on ALL of the 100's of libraries used in an ANGULAR project which really sucks!

Before submitting, please confirm:

  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

brianreinhold avatar Sep 23 '24 11:09 brianreinhold