typescript icon indicating copy to clipboard operation
typescript copied to clipboard

Error TS2411: Property '"Fn::Transform"' is not assignable to 'string' index type

Open zirkelc opened this issue 1 year ago • 3 comments

I created types for the serverless-step-functions plugin and submitted it to DefinitelyTyped PR#66693.

The @types/serverless-step-functions depend on this package, because it uses module augmentation to merge the StepFunctions types into the Serverless type.

However, the CI on the PR fails due to errors in this package: Test Log image

The mentioned lines of code node_modules/@serverless/typescript/index.d.ts(1348,7) are these: https://github.com/serverless/typescript/blob/29ea18f8eae4ab8329391d8d3986cda1d1c92728/index.d.ts#L1360-L1390

The property "Fn::Transform"?: can be undefined while the index type [k: string]: can't be undefined. I assume changing it to [k: string]?: would be enough to fix it?

zirkelc avatar Sep 24 '23 05:09 zirkelc

Hi @zirkelc and thanks for reporting this issue. The types generated from this package comes from @serverless/serverless schema definitions. You can submit a PR on the repo to change corresponding schema to match your requirements. The incriminated lines: https://github.com/serverless/serverless/blob/main/lib/plugins/aws/provider.js#L1611-L1619

fredericbarthelet avatar Sep 25 '23 07:09 fredericbarthelet

Hi @fredericbarthelet thanks for the info! Are you able to move the issue to the other repo? Otherwise I will recreate it there.

zirkelc avatar Sep 25 '23 08:09 zirkelc

@zirkelc see workaround discussions in #27

herebebogans avatar Nov 17 '23 00:11 herebebogans