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

Introduce ID, Int, and Float Types #31

Closed
schettn opened this issue Oct 8, 2024 · 2 comments · Fixed by #30
Closed

Introduce ID, Int, and Float Types #31

schettn opened this issue Oct 8, 2024 · 2 comments · Fixed by #30
Assignees
Labels
🕹 aspect: interface Concerns end-users' experience with the software ⭐ goal: addition Addition of new feature 🟨 priority: medium Not blocking but should be fixed soon released 🏁 status: ready for de Ready for work

Comments

@schettn
Copy link
Contributor

schettn commented Oct 8, 2024

Description:
Currently, in our Pylon implementation, we are using the Number scalar type to represent numeric values. However, JavaScript only has a single number type that encompasses both integers and floats. This can lead to challenges when mapping to GraphQL's distinct Int and Float types.

To enhance type clarity and provide better support for GraphQL features like syntax highlighting and validation, I propose the introduction of ID, Int, and Float types in Pylon. This will allow us to use GraphQL's Int and Float types directly instead of relying on the Number scalar.

Implementation Example:

import { app, ID, Int, Float } from '@getcronit/pylon';

class User {
  id: ID;
  name: string;
  email: string;
  someNumber: number = 1; // Still uses the `Number` scalar
  someField: Float = 1.0;
  someOtherField: Int = 1;

  constructor(id: ID, name: string, email: string) {
    this.id = id;
    this.name = name;
    this.email = email;
  }
}

Benefits:

  • Improved compatibility with GraphQL's type system.
  • Enhanced syntax highlighting and validation in GraphQL tools.
  • Clearer code representation, distinguishing between integers and floats.

ref: TypeStrong/typedoc#1502

@schettn schettn added 🟨 priority: medium Not blocking but should be fixed soon 🏁 status: ready for de Ready for work ⭐ goal: addition Addition of new feature 🕹 aspect: interface Concerns end-users' experience with the software labels Oct 8, 2024
@schettn schettn self-assigned this Oct 8, 2024
schettn added a commit that referenced this issue Oct 8, 2024
Copy link

github-actions bot commented Oct 8, 2024

🎉 This issue has been resolved in version @getcronit/pylon-builder-v2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Oct 8, 2024

🎉 This issue has been resolved in version @getcronit/pylon-v2.2.0 🎉

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
🕹 aspect: interface Concerns end-users' experience with the software ⭐ goal: addition Addition of new feature 🟨 priority: medium Not blocking but should be fixed soon released 🏁 status: ready for de Ready for work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant