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 @@ -717,6 +717,17 @@ Data passed to a Brotli stream was not successfully compressed.
717
717
718
718
An invalid parameter key was passed during construction of a Brotli stream.
719
719
720
+ <a id =" ERR_NO_TYPESCRIPT " ></a >
721
+
722
+ ### ` ERR_NO_TYPESCRIPT `
723
+
724
+ <!-- YAML
725
+ added: REPLACEME
726
+ -->
727
+
728
+ An attempt was made to use features that require [ Native TypeScript support] [ ] , but Node.js was not
729
+ compiled with TypeScript support.
730
+
720
731
<a id =" ERR_BUFFER_CONTEXT_NOT_AVAILABLE " ></a >
721
732
722
733
### ` ERR_BUFFER_CONTEXT_NOT_AVAILABLE `
@@ -4111,6 +4122,7 @@ An error occurred trying to allocate memory. This should never happen.
4111
4122
[ ICU ] : intl.md#internationalization-support
4112
4123
[ JSON Web Key Elliptic Curve Registry ] : https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve
4113
4124
[ JSON Web Key Types Registry ] : https://www.iana.org/assignments/jose/jose.xhtml#web-key-types
4125
+ [ Native TypeScript support ] : typescript.md#type-stripping
4114
4126
[ Node.js error codes ] : #nodejs-error-codes
4115
4127
[ Permission Model ] : permissions.md#permission-model
4116
4128
[ RFC 7230 Section 3 ] : https://tools.ietf.org/html/rfc7230#section-3
Original file line number Diff line number Diff line change @@ -1600,6 +1600,8 @@ E('ERR_NO_CRYPTO',
1600
1600
'Node.js is not compiled with OpenSSL crypto support' , Error ) ;
1601
1601
E ( 'ERR_NO_ICU' ,
1602
1602
'%s is not supported on Node.js compiled without ICU' , TypeError ) ;
1603
+ E ( 'ERR_NO_TYPESCRIPT' ,
1604
+ 'Node.js is not compiled with TypeScript support' , Error ) ;
1603
1605
E ( 'ERR_OPERATION_FAILED' , 'Operation failed: %s' , Error , TypeError ) ;
1604
1606
E ( 'ERR_OUT_OF_RANGE' ,
1605
1607
( str , range , input , replaceDefaultBoolean = false ) => {
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ const assert = require('internal/assert');
27
27
28
28
const { Buffer } = require ( 'buffer' ) ;
29
29
const { getOptionValue } = require ( 'internal/options' ) ;
30
- const { setOwnProperty, getLazy } = require ( 'internal/util' ) ;
30
+ const { assertTypeScript , setOwnProperty, getLazy } = require ( 'internal/util' ) ;
31
31
const { inspect } = require ( 'internal/util/inspect' ) ;
32
32
33
33
const lazyTmpdir = getLazy ( ( ) => require ( 'os' ) . tmpdir ( ) ) ;
@@ -342,6 +342,7 @@ function loadTypeScriptParser(parser) {
342
342
if ( parser ) {
343
343
typeScriptParser = parser ;
344
344
} else {
345
+ assertTypeScript ( ) ;
345
346
const amaro = require ( 'internal/deps/amaro/dist/index' ) ;
346
347
// Default option for Amaro is to perform Type Stripping only.
347
348
typeScriptParsingMode = getOptionValue ( '--experimental-transform-types' ) ? 'transform' : 'strip-only' ;
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