Skip to content

Commit

Permalink
feat: support class properties
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Feb 26, 2020
1 parent 67987b7 commit 0a04bf7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ module.exports = {
loader: 'babel-loader-8',
options: {
plugins: [
// Transpile class properties
// @see https://github.com/typed-ember/ember-cli-typescript/blob/b2e75abc98beefe635b6cfd8808c887813acb44e/ts/addon.ts#L99
require.resolve('@babel/plugin-proposal-class-properties'),

// Transpile new syntax, which is apparently not yet handled by
// `@babel/preset-env`.
// @see https://github.com/typed-ember/ember-cli-typescript/blob/b2e75abc98beefe635b6cfd8808c887813acb44e/ts/addon.ts#L89-L94
Expand Down
1 change: 1 addition & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"lint:js": "eslint --ext ts,js ."
},
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
"@babel/preset-env": "^7.8.4",
Expand Down
4 changes: 4 additions & 0 deletions tests/ts-module-b/some/nested-file.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export class Foo {
bar = false;
}

const foo = { bar: { baz: undefined } };

export const works = foo.bar?.baz ?? (() => true);

0 comments on commit 0a04bf7

Please sign in to comment.