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

Non-required attributes are not automatically generated to have | null appended to type #148

Open
mkmckenzie opened this issue Dec 9, 2023 · 0 comments

Comments

@mkmckenzie
Copy link

The documentation states:

Non-required attributes automatically have | null appended to their type.

However after generating types, there is not a single instance of null in the generated files, despite dozens of attributes being non-required.

Node version: 16.17.0
Package version: 3.4.0

Yarn script:

yarn contentful-typescript-codegen --output src/types/contentful/types.generated.ts --fieldsOnly && contentful-typescript-codegen --output server/types/contentful/types.generated.ts --fieldsOnly

Expected output:

      /** Add To Bag Text */
    addToBagText?: string | null;

    /** Bag Text */
    bagText?: string | null;

    /** Added To Bag Text */
    addedToBagText?: string | null;

Actual output:

      /** Add To Bag Text */
    addToBagText?: string | undefined;

    /** Bag Text */
    bagText?: string | undefined;

    /** Added To Bag Text */
    addedToBagText?: string | undefined;

Any debugging guidance would be greatly appreciated! Thank you!

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

1 participant