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

feat: add consumer types for Model APIs #9245

Merged
merged 20 commits into from
Mar 9, 2024
Merged

feat: add consumer types for Model APIs #9245

merged 20 commits into from
Mar 9, 2024

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Mar 4, 2024

adds types for

  • decorators
    • attr
      • transforms
      class {
        @attr declare name string;
        
        // enforces transform name is a string, and defaultValue is a primitive or function
        // and no other keys allowed on the options hash
        @attr('string', { defaultValue: 'hello world' }) declare name string;
        
        // enforces that defaultValue is a primitive or function and no other keys allowed
        // on the options hash
        @attr({ defaultValue: 'hello world' }) declare name string;
        
        // enforces that the transform name matches the brand symbol on StringTransform
        // enforces that defaultValue is a primitive value or function whose type matches
        // the transform's output
        // enforces that only options allowed by the transform are able to be passed into
        // the options object
        @attr<StringTransform>('string', { defaultValue: 'hello world' }) declare name string;
      }
    • belongsTo
    • hasMany
  • Model APIs
    • record.belongsTo()
    • record.hasMany()

adds type utils for

  • async hasMany
  • async belongsTo

@runspired runspired added 🎯 canary PR is targeting canary (default) 🏷️ feat This PR introduces a new feature typescript For issues and PRs relating to typescript convertion labels Mar 4, 2024
@runspired runspired merged commit 65b8a06 into main Mar 9, 2024
19 of 20 checks passed
@runspired runspired deleted the add-type-tests branch March 9, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎯 canary PR is targeting canary (default) 🏷️ feat This PR introduces a new feature typescript For issues and PRs relating to typescript convertion
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant