File tree Expand file tree Collapse file tree 4 files changed +22
-24
lines changed Expand file tree Collapse file tree 4 files changed +22
-24
lines changed Original file line number Diff line number Diff line change 126
126
"testdouble" : " 3.12.4" ,
127
127
"tmp" : " 0.1.0" ,
128
128
"ts-node" : " 8.4.1" ,
129
- "typescript" : " 3.6.4 "
129
+ "typescript" : " 3.7.2 "
130
130
},
131
131
"resolutions" : {
132
132
"@types/ember" : " 3.1.1" ,
Original file line number Diff line number Diff line change @@ -39,4 +39,13 @@ module('Unit | Build', function() {
39
39
let instance = new TestClass ( 'hello' ) ;
40
40
assert . equal ( instance . field , 'hello' ) ;
41
41
} ) ;
42
+
43
+ // TODO: enable once a release of Prettier comes out that supports this syntax
44
+ // test('optional chaining and nullish coalescing are transpiled correctly', function(assert) {
45
+ // let value = { a: 'hello' } as { a?: string; b?: string };
46
+ // assert.equal(value?.a, 'hello');
47
+ // assert.equal(value?.b, undefined);
48
+ // assert.equal(value?.a ?? 'ok', 'hello');
49
+ // assert.equal(value?.b ?? 'ok', 'ok');
50
+ // });
42
51
} ) ;
Original file line number Diff line number Diff line change @@ -79,11 +79,10 @@ export default addon({
79
79
80
80
// As of 3.7, TS supports the optional chaining and nullish coalescing proposals.
81
81
// https://devblogs.microsoft.com/typescript/announcing-typescript-3-7-beta/
82
- let tsVersion = this . _getProjectTypeScriptVersion ( ) ;
83
- if ( semver . gte ( tsVersion , '3.7.0-alpha.0' ) ) {
84
- this . _addBabelPluginIfNotPresent ( '@babel/plugin-proposal-optional-chaining' ) ;
85
- this . _addBabelPluginIfNotPresent ( '@babel/plugin-proposal-nullish-coalescing-operator' ) ;
86
- }
82
+ // Since we can't necessarily know what version of TS an addon was developed with,
83
+ // we unconditionally add the Babel plugins for both proposals.
84
+ this . _addBabelPluginIfNotPresent ( '@babel/plugin-proposal-optional-chaining' ) ;
85
+ this . _addBabelPluginIfNotPresent ( '@babel/plugin-proposal-nullish-coalescing-operator' ) ;
87
86
88
87
// Needs to come after the class properties plugin (see tests/unit/build-test.ts -
89
88
// "property initialization occurs in the right order")
@@ -190,17 +189,6 @@ export default addon({
190
189
}
191
190
} ,
192
191
193
- _getProjectTypeScriptVersion ( ) {
194
- try {
195
- let pkg = this . project . require ( 'typescript/package.json' ) as { version : string } ;
196
- return pkg . version ;
197
- } catch {
198
- throw new Error (
199
- `[ember-cli-typescript] Unable to determine project TypeScript version; is it installed?`
200
- ) ;
201
- }
202
- } ,
203
-
204
192
_addTypecheckMiddleware ( app : Application ) {
205
193
let workerPromise = this . _getTypecheckWorker ( ) ;
206
194
let middleware = new TypecheckMiddleware ( this . project , workerPromise ) ;
Original file line number Diff line number Diff line change @@ -7572,7 +7572,6 @@ esdoc-ecmascript-proposal-plugin@^1.0.0:
7572
7572
7573
7573
esdoc@pzuraq/esdoc#015a342:
7574
7574
version "1.0.4"
7575
- uid "015a3426b2e53b2b0270a9c00133780db3f1d144"
7576
7575
resolved "https://codeload.github.com/pzuraq/esdoc/tar.gz/015a3426b2e53b2b0270a9c00133780db3f1d144"
7577
7576
dependencies:
7578
7577
babel-generator "6.26.0"
@@ -9516,10 +9515,12 @@ imurmurhash@^0.1.4:
9516
9515
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
9517
9516
9518
9517
"in-repo-a@link:tests/dummy/lib/in-repo-a":
9519
- version "1.0.0"
9518
+ version "0.0.0"
9519
+ uid ""
9520
9520
9521
9521
"in-repo-b@link:tests/dummy/lib/in-repo-b":
9522
- version "1.0.0"
9522
+ version "0.0.0"
9523
+ uid ""
9523
9524
9524
9525
include-path-searcher@^0.1.0:
9525
9526
version "0.1.0"
@@ -15718,10 +15719,10 @@ typescript-memoize@^1.0.0-alpha.3:
15718
15719
dependencies:
15719
15720
core-js "2.4.1"
15720
15721
15721
- typescript@3.6.4 :
15722
- version "3.6.4 "
15723
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4 .tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d "
15724
- integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg ==
15722
+ typescript@3.7.2 :
15723
+ version "3.7.2 "
15724
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2 .tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb "
15725
+ integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ ==
15725
15726
15726
15727
uc.micro@^1.0.0, uc.micro@^1.0.1, uc.micro@^1.0.5:
15727
15728
version "1.0.6"
You can’t perform that action at this time.
0 commit comments