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 TS2411: Property '"Fn::Transform"' is not assignable to 'string' index type #82

Open
zirkelc opened this issue Sep 24, 2023 · 3 comments

Comments

@zirkelc
Copy link

zirkelc commented Sep 24, 2023

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:

typescript/index.d.ts

Lines 1360 to 1390 in 29ea18f

Resources?: {
"Fn::Transform"?: {
Name: string;
Parameters?: {
[k: string]: unknown;
};
};
/**
* This interface was referenced by `undefined`'s JSON-Schema definition
* via the `patternProperty` "^[a-zA-Z0-9]{1,255}$".
*/
[k: string]: {
Type: string;
Properties?: {
[k: string]: unknown;
};
CreationPolicy?: {
[k: string]: unknown;
};
DeletionPolicy?: string;
DependsOn?: AwsResourceDependsOn;
Metadata?: {
[k: string]: unknown;
};
UpdatePolicy?: {
[k: string]: unknown;
};
UpdateReplacePolicy?: string;
Condition?: AwsResourceCondition;
};
};

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?

@fredericbarthelet
Copy link
Contributor

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

@zirkelc
Copy link
Author

zirkelc commented Sep 25, 2023

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

@herebebogans
Copy link

@zirkelc see workaround discussions in #27

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

3 participants