Skip to content

Snippets and auto-imports for ember-decorators in TypeScript

Notifications You must be signed in to change notification settings

mfeckie/vscode-ember-decorators

Repository files navigation

ember-decorators README

Provides snippets and auto-imports for using ember-decorators with typescript files

Features

Take your object based attr's and convert them to decorated class attrs. Currently doesn't attempt to move them to the class portion of this declaration, but will do the majority of the grunt work for you.

consider the following

convert to decorats attrs

export default class Foo extends Model.extend({
  thing: attr(),
  foo: attr('string'),
  baz: attr('number')
}) {}

Step 1, move your attrs into the class body (which will cause lots of underlined errors! )

export default class Foo extends Model.extend({}) {
  thing: attr(),
  foo: attr('string'),
  baz: attr('number')
}

Then run Ember Decorators: Convert attr to @attr, which will then do a best attempt at converting attrs.

export default class Foo extends Model.extend({

}) {
  @attr() thing;
  @attr('string') foo;
  @attr('number') baz;
}

Known Issues

Does not provide support for javascript currently, only TypeScript is supported.

Changelog

0.0.1 - Initial release 0.0.2 - Add support for all computeds 0.0.3 - Add command to convert attr to decorated @attr in ember-data models 0.0.4 - Indent with spaces

About

Snippets and auto-imports for ember-decorators in TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published