Skip to content

feat: add consumer types for Model APIs#9245

Merged
runspired merged 20 commits intomainfrom
add-type-tests
Mar 9, 2024
Merged

feat: add consumer types for Model APIs#9245
runspired merged 20 commits intomainfrom
add-type-tests

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
@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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant