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

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

Open
2 tasks done
brianreinhold opened this issue Sep 23, 2024 · 3 comments
Labels
DataStore Related to DataStore category pending-maintainer-response Issue is pending a response from the Amplify team. transferred This issue was transferred from another Amplify project TypeScript Related to TypeScript issues

Comments

@brianreinhold
Copy link

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:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@brianreinhold brianreinhold added the pending-triage Issue is pending triage label Sep 23, 2024
@brianreinhold brianreinhold changed the title Error: node_modules/@aws-amplify/datastore/lib-esm/types.d.ts:252:371 - error TS2536: Type '"field"' cannot be used to index type ... Error: @aws-amplify/datastore/lib-esm/types.d.ts- error TS2536: Type '"field"' cannot be used to index type ... Sep 23, 2024
@ykethan
Copy link
Member

ykethan commented Sep 24, 2024

Hey @brianreinhold, thank you for reaching out. Transferring the issue to our JS repository for better assistance.

@ykethan ykethan transferred this issue from aws-amplify/amplify-cli Sep 24, 2024
@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Sep 24, 2024
@ykethan ykethan added transferred This issue was transferred from another Amplify project and removed pending-maintainer-response Issue is pending a response from the Amplify team. labels Sep 24, 2024
@HuiSF HuiSF added the DataStore Related to DataStore category label Sep 24, 2024
@chrisbonifacio chrisbonifacio added TypeScript Related to TypeScript issues and removed pending-triage Issue is pending triage labels Oct 3, 2024
@Naikno
Copy link

Naikno commented Oct 17, 2024

I have the same problem with Angular 17...any update, solution or workaround? this is blocker.

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Oct 17, 2024
@brianreinhold
Copy link
Author

@Naikno I posted my workaround above, though I did not like having to do it. Basically I turned off type checking in all libraries (at least it remains in the code that I write).

I did this:

Workaround: Add
"skipLibCheck": true,

to the ts.config file's compiler options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataStore Related to DataStore category pending-maintainer-response Issue is pending a response from the Amplify team. transferred This issue was transferred from another Amplify project TypeScript Related to TypeScript issues
Projects
None yet
Development

No branches or pull requests

5 participants