File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -2330,6 +2330,17 @@ OpenSSL crypto support.
23302330An attempt was made to use features that require [ ICU] [ ] , but Node.js was not
23312331compiled with ICU support.
23322332
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+
23332344<a id =" ERR_OPERATION_FAILED " ></a >
23342345
23352346### ` ERR_OPERATION_FAILED `
@@ -4128,6 +4139,7 @@ An error occurred trying to allocate memory. This should never happen.
41284139[ ICU ] : intl.md#internationalization-support
41294140[ JSON Web Key Elliptic Curve Registry ] : https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve
41304141[ JSON Web Key Types Registry ] : https://www.iana.org/assignments/jose/jose.xhtml#web-key-types
4142+ [ Native TypeScript support ] : typescript.md#type-stripping
41314143[ Node.js error codes ] : #nodejs-error-codes
41324144[ Permission Model ] : permissions.md#permission-model
41334145[ 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',
16011601 'Node.js is not compiled with OpenSSL crypto support' , Error ) ;
16021602E ( 'ERR_NO_ICU' ,
16031603 '%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 ) ;
16041606E ( 'ERR_OPERATION_FAILED' , 'Operation failed: %s' , Error , TypeError ) ;
16051607E ( 'ERR_OUT_OF_RANGE' ,
16061608 ( str , range , input , replaceDefaultBoolean = false ) => {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const assert = require('internal/assert');
2828
2929const { Buffer } = require ( 'buffer' ) ;
3030const { getOptionValue } = require ( 'internal/options' ) ;
31- const { setOwnProperty, getLazy } = require ( 'internal/util' ) ;
31+ const { assertTypeScript , setOwnProperty, getLazy } = require ( 'internal/util' ) ;
3232const { inspect } = require ( 'internal/util/inspect' ) ;
3333
3434const lazyTmpdir = getLazy ( ( ) => require ( 'os' ) . tmpdir ( ) ) ;
@@ -327,6 +327,7 @@ const getTypeScriptParsingMode = getLazy(() =>
327327 * @returns {Function } The TypeScript parser function.
328328 */
329329const loadTypeScriptParser = getLazy ( ( ) => {
330+ assertTypeScript ( ) ;
330331 const amaro = require ( 'internal/deps/amaro/dist/index' ) ;
331332 return amaro . transformSync ;
332333} ) ;
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const {
4545const {
4646 codes : {
4747 ERR_NO_CRYPTO ,
48+ ERR_NO_TYPESCRIPT ,
4849 ERR_UNKNOWN_SIGNAL ,
4950 } ,
5051 isErrorStackTraceLimitWritable,
@@ -65,6 +66,7 @@ const { getOptionValue } = require('internal/options');
6566const { encodings } = internalBinding ( 'string_decoder' ) ;
6667
6768const noCrypto = ! process . versions . openssl ;
69+ const noTypeScript = ! process . versions . amaro ;
6870
6971const isWindows = process . platform === 'win32' ;
7072const isMacOS = process . platform === 'darwin' ;
@@ -194,6 +196,11 @@ function assertCrypto() {
194196 throw new ERR_NO_CRYPTO ( ) ;
195197}
196198
199+ function assertTypeScript ( ) {
200+ if ( noTypeScript )
201+ throw new ERR_NO_TYPESCRIPT ( ) ;
202+ }
203+
197204/**
198205 * Move the "slow cases" to a separate function to make sure this function gets
199206 * inlined properly. That prioritizes the common case.
@@ -861,6 +868,7 @@ for (let i = 0; i < encodings.length; ++i)
861868module . exports = {
862869 getLazy,
863870 assertCrypto,
871+ assertTypeScript,
864872 cachedResult,
865873 convertToValidSignal,
866874 createClassWrapper,
You can’t perform that action at this time.
0 commit comments