File tree 4 files changed +24
-1
lines changed
4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -2330,6 +2330,17 @@ OpenSSL crypto support.
2330
2330
An attempt was made to use features that require [ ICU] [ ] , but Node.js was not
2331
2331
compiled with ICU support.
2332
2332
2333
+ <a id =" ERR_NO_TYPESCRIPT " ></a >
2334
+
2335
+ ### ` ERR_NO_TYPESCRIPT `
2336
+
2337
+ <!-- YAML
2338
+ added: REPLACEME
2339
+ -->
2340
+
2341
+ An attempt was made to use features that require [ Native TypeScript support] [ ] , but Node.js was not
2342
+ compiled with TypeScript support.
2343
+
2333
2344
<a id =" ERR_OPERATION_FAILED " ></a >
2334
2345
2335
2346
### ` ERR_OPERATION_FAILED `
@@ -4128,6 +4139,7 @@ An error occurred trying to allocate memory. This should never happen.
4128
4139
[ ICU ] : intl.md#internationalization-support
4129
4140
[ JSON Web Key Elliptic Curve Registry ] : https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve
4130
4141
[ JSON Web Key Types Registry ] : https://www.iana.org/assignments/jose/jose.xhtml#web-key-types
4142
+ [ Native TypeScript support ] : typescript.md#type-stripping
4131
4143
[ Node.js error codes ] : #nodejs-error-codes
4132
4144
[ Permission Model ] : permissions.md#permission-model
4133
4145
[ RFC 7230 Section 3 ] : https://tools.ietf.org/html/rfc7230#section-3
Original file line number Diff line number Diff line change @@ -1601,6 +1601,8 @@ E('ERR_NO_CRYPTO',
1601
1601
'Node.js is not compiled with OpenSSL crypto support' , Error ) ;
1602
1602
E ( 'ERR_NO_ICU' ,
1603
1603
'%s is not supported on Node.js compiled without ICU' , TypeError ) ;
1604
+ E ( 'ERR_NO_TYPESCRIPT' ,
1605
+ 'Node.js is not compiled with TypeScript support' , Error ) ;
1604
1606
E ( 'ERR_OPERATION_FAILED' , 'Operation failed: %s' , Error , TypeError ) ;
1605
1607
E ( 'ERR_OUT_OF_RANGE' ,
1606
1608
( str , range , input , replaceDefaultBoolean = false ) => {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const assert = require('internal/assert');
28
28
29
29
const { Buffer } = require ( 'buffer' ) ;
30
30
const { getOptionValue } = require ( 'internal/options' ) ;
31
- const { setOwnProperty, getLazy } = require ( 'internal/util' ) ;
31
+ const { assertTypeScript , setOwnProperty, getLazy } = require ( 'internal/util' ) ;
32
32
const { inspect } = require ( 'internal/util/inspect' ) ;
33
33
34
34
const lazyTmpdir = getLazy ( ( ) => require ( 'os' ) . tmpdir ( ) ) ;
@@ -327,6 +327,7 @@ const getTypeScriptParsingMode = getLazy(() =>
327
327
* @returns {Function } The TypeScript parser function.
328
328
*/
329
329
const loadTypeScriptParser = getLazy ( ( ) => {
330
+ assertTypeScript ( ) ;
330
331
const amaro = require ( 'internal/deps/amaro/dist/index' ) ;
331
332
return amaro . transformSync ;
332
333
} ) ;
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const {
45
45
const {
46
46
codes : {
47
47
ERR_NO_CRYPTO ,
48
+ ERR_NO_TYPESCRIPT ,
48
49
ERR_UNKNOWN_SIGNAL ,
49
50
} ,
50
51
isErrorStackTraceLimitWritable,
@@ -65,6 +66,7 @@ const { getOptionValue } = require('internal/options');
65
66
const { encodings } = internalBinding ( 'string_decoder' ) ;
66
67
67
68
const noCrypto = ! process . versions . openssl ;
69
+ const noTypeScript = ! process . versions . amaro ;
68
70
69
71
const isWindows = process . platform === 'win32' ;
70
72
const isMacOS = process . platform === 'darwin' ;
@@ -194,6 +196,11 @@ function assertCrypto() {
194
196
throw new ERR_NO_CRYPTO ( ) ;
195
197
}
196
198
199
+ function assertTypeScript ( ) {
200
+ if ( noTypeScript )
201
+ throw new ERR_NO_TYPESCRIPT ( ) ;
202
+ }
203
+
197
204
/**
198
205
* Move the "slow cases" to a separate function to make sure this function gets
199
206
* inlined properly. That prioritizes the common case.
@@ -861,6 +868,7 @@ for (let i = 0; i < encodings.length; ++i)
861
868
module . exports = {
862
869
getLazy,
863
870
assertCrypto,
871
+ assertTypeScript,
864
872
cachedResult,
865
873
convertToValidSignal,
866
874
createClassWrapper,
You can’t perform that action at this time.
0 commit comments