contentful-typescript-codegen icon indicating copy to clipboard operation
contentful-typescript-codegen copied to clipboard

Syntax error from code generation

Open holdenmad opened this issue 2 years ago • 0 comments

I'm having a problem with various apps that are using the cf-content-types-generator, specifically this app which I'm using in Contentful. The same thing is happening from contentful-typescript-codegen.

What is happening is when I try to generate types, a clear syntax error is happening which comes from an extra semicolon and backslash at the end of the colorPalette line:

export interface TypeComponentTextBlockFields {
    internalName?: Contentful.EntryFields.Symbol;
    headline?: Contentful.EntryFields.Symbol;
    subline?: Contentful.EntryFields.Symbol;
    body?: CFRichTextTypes.Block | CFRichTextTypes.Inline;
    colorPalette?: "1. White (#FFFFFF)" | "2. White Smoke (#FCFCFC)" | "3. Light Gray (#F4F4F4)" | "4. Gray (#EAEAEA)" | "5. Steel Gray (#BBBBBB)" | "6. Dark Gray (#797979)" | "7. Black (#000000)\";;
}

I don't know why this is happening, but it means that I can't usefully use the package/script as a single command or as part of CI/CD, since linting stops it. Currently I have to use the Contentful app and then manually edit the file to allow the project to use the types correctly.

What could be causing this error? Let me know if I can provide more information.

holdenmad avatar Feb 20 '23 14:02 holdenmad