Skip to content

fix: GitHubProjectItem fields type #34

Merged
gr2m merged 4 commits intomainfrom
tfields-type-nullable
Mar 16, 2022
Merged

fix: GitHubProjectItem fields type #34
gr2m merged 4 commits intomainfrom
tfields-type-nullable

Conversation

@mikesurowiec
Copy link
Copy Markdown
Collaborator

@mikesurowiec mikesurowiec commented Mar 16, 2022

Closes #33

Makes the type of the field value of a project item string | null and fixes the string literal value that was coming from BUILT_IN_FIELDS type.

Previously: item.fields.status: ("Status")
After this change: item.fields.status: (string | null)

This more accurately represents the possible (and accepted) values.

Some of the changes may appear duplicative, but this was in the interest of being able to use the GitHubProjectItem outside of the context of a project (for example, if the type were imported in directly).

The addition of the jsconfig.json was necessary for me to see the changes since it appears strictNullChecks is not enabled by default. https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#unsupported-patterns

Comment thread jsconfig.json
Comment on lines +1 to +5
{
"compilerOptions": {
"strictNullChecks": true
}
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean that the projects importing github-project will need the setting as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Need" only in the sense that if they want to see null types they either need strict mode or strictNullChecks enabled. It works as expected without that setting enabled at the TS level, so string | null just looks like string

@gr2m gr2m merged commit 6bdcd87 into main Mar 16, 2022
@gr2m gr2m deleted the tfields-type-nullable branch March 16, 2022 04:17
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TFields values should be of type string | null

2 participants