diff --git a/lib/formats.d.ts b/lib/formats.d.ts deleted file mode 100644 index 4a63d648..00000000 --- a/lib/formats.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { FormatsExport } from './qs'; - -export = FormatsExport diff --git a/lib/formats.js b/lib/formats.js index d05cc15f..28d53d13 100644 --- a/lib/formats.js +++ b/lib/formats.js @@ -1,10 +1,23 @@ 'use strict'; +/** @type {function(string | RegExp, string): string} */ var replace = String.prototype.replace; var percentTwenties = /%20/g; -/** @type {import('./qs').FormatsExport} */ -var formatsExport = { +/** @typedef {'RFC1738' | 'RFC3986'} Format */ +/** @callback Formatter + * + * @param {string | Buffer} value + * @returns {string} + */ + +/** @type {{ + * default: Format, + * formatters: { [s: string]: Formatter }, + * RFC1738: 'RFC1738', + * RFC3986: 'RFC3986', + * }} */ +module.exports = { 'default': 'RFC3986', formatters: { @@ -19,5 +32,3 @@ var formatsExport = { RFC1738: 'RFC1738', RFC3986: 'RFC3986' }; - -module.exports = formatsExport; diff --git a/lib/index.d.ts b/lib/index.d.ts deleted file mode 100644 index 2737b8f4..00000000 --- a/lib/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Stringify, Parse, FormatsExport } from './qs'; - -type qs = { - stringify: Stringify, - parse: Parse, - formats: FormatsExport, -}; - -export = qs; diff --git a/lib/parse.d.ts b/lib/parse.d.ts deleted file mode 100644 index ce5e561e..00000000 --- a/lib/parse.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Parse } from './qs'; - -export = Parse; diff --git a/lib/parse.js b/lib/parse.js index fd9a14a2..56de93d5 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -4,8 +4,30 @@ var utils = require('./utils'); var has = Object.prototype.hasOwnProperty; -/** @typedef {import('./qs').ParseOptionsInternal} ParseOptionsInternal */ -/** @typedef {import('./qs').ParseOptions} ParseOptions */ +/** @typedef {import('./utils').UtilOptions} UtilOptions */ +/** @typedef {import('./utils').Decoder} Decoder */ + +/** @callback InterpretNumericEntities + * + * @param {string} str + * @returns str + */ +/** @typedef ParseOptionsInternalType + * + * @property {boolean} allowPrototypes + * @property {number} arrayLimit + * @property {string | RegExp} delimiter + * @property {boolean} ignoreQueryPrefix + * @property {boolean | InterpretNumericEntities} interpretNumericEntities + * @property {number} parameterLimit + * @property {boolean} strictNullHandling + * @property {boolean} charsetSentinel + * @property {Decoder} decoder + * @property {number} depth + * @property {boolean} parseArrays + */ +/** @typedef {UtilOptions & ParseOptionsInternalType} ParseOptionsInternal */ +/** @typedef {Partial & { decoder?: Decoder }} ParseOptions */ /** @type {ParseOptions & Pick} */ var defaults = { @@ -25,7 +47,7 @@ var defaults = { strictNullHandling: false }; -/** @type {import('./qs').InterpretNumericEntities} */ +/** @type {InterpretNumericEntities} */ var interpretNumericEntities = function (str) { return str.replace( /&#(\d+);/g, @@ -53,7 +75,7 @@ var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓') /** * @param {string} str * @param {ParseOptionsInternal} options - * @returns {object | Array<*>} + * @returns {NonPrimitive | Array<*>} */ var parseValues = function parseQueryStringValues(str, options) { var obj = {}; @@ -112,7 +134,7 @@ var parseValues = function parseQueryStringValues(str, options) { /** * @param {string[]} chain - * @param {object=} val + * @param {NonPrimitive=} val * @param {ParseOptionsInternal} options * @returns */ @@ -124,7 +146,7 @@ var parseObject = function (chain, val, options) { var root = chain[i]; if (root === '[]' && options.parseArrays) { - obj = [].concat(leaf); + obj = /** @type {*} */([]).concat(leaf); } else { obj = options.plainObjects ? Object.create(null) : {}; var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; @@ -153,9 +175,9 @@ var parseObject = function (chain, val, options) { /** * @param {string=} givenKey - * @param {object=} val + * @param {NonPrimitive=} val * @param {ParseOptionsInternal} options - * @returns {object} + * @returns {NonPrimitive | undefined} */ var parseKeys = function parseQueryStringKeys(givenKey, val, options) { if (!givenKey) { @@ -211,8 +233,13 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) { return parseObject(keys, val, options); }; -/** @type {import('./qs').Parse} */ +/** + * @param {NonPrimitive | string | Nullish} str + * @param {ParseOptions} [opts] + * @returns {NonPrimitive | Array} + */ module.exports = function (str, opts) { + /** @type {ParseOptions} */ var options = opts ? utils.assign({}, opts) : {}; if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') { @@ -242,7 +269,8 @@ module.exports = function (str, opts) { return options.plainObjects ? Object.create(null) : {}; } - var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var internalOptions = /** @type {ParseOptionsInternal} */(options); + var tempObj = typeof str === 'string' ? parseValues(str, internalOptions) : str; var obj = options.plainObjects ? Object.create(null) : {}; // Iterate over the keys and setup the new object @@ -250,8 +278,8 @@ module.exports = function (str, opts) { var keys = Object.keys(tempObj); for (var i = 0; i < keys.length; ++i) { var key = keys[i]; - var newObj = parseKeys(key, tempObj[key], options); - obj = utils.merge(obj, newObj, options); + var newObj = parseKeys(key, tempObj[key], internalOptions); + obj = utils.merge(obj, newObj, internalOptions); } return utils.compact(obj); diff --git a/lib/qs.d.ts b/lib/qs.d.ts index 0f12482c..2f44b850 100644 --- a/lib/qs.d.ts +++ b/lib/qs.d.ts @@ -1,157 +1,8 @@ -export type Format = 'RFC1738' | 'RFC3986'; - -export type Formatter = (value: string | Buffer) => string; - -type Formats = { - [format in Format]: format -}; - -type Formatters = { - [format in Format]: Formatter -}; - -export type FormatsExport = { - default: Format, - formatters: Formatters, -} & Formats; - -export type ArrayFormat = 'brackets' | 'indices' | 'repeat'; - -export type arrayPrefixGenerator = (prefix: string, key?: string) => string; - -export type arrayPrefixGenerators = { - [format in ArrayFormat]: arrayPrefixGenerator -} - -export type Filter = (prefix: string, obj: T) => T; - -export type Comparator = (a: Value, b: Value) => number; - -export type Charset = 'iso-8859-1' | 'utf-8'; - -export type Decoder = ( - str: string, - defaultDecoder: Decoder, - charset: Charset -) => string; - -export type Encoder = ( - str: string | Buffer, - defaultEncoder: Encoder, - charset?: Charset -) => string | Buffer; - -export type UtilOptions = { - allowDots: boolean, - charset: Charset, - plainObjects: boolean, -}; - -export type UtilOptionsInternal = UtilOptions & { - allowPrototypes: boolean, - arrayLimit: number, -}; - type Nullish = null | undefined; type NonNullishPrimitive = boolean | number | string | symbol; -type ObjectCoercible = {} | NonNullishPrimitive; -type ObjectIndexable = { [key: string]: Value } | NonNullishPrimitive; +type ObjectCoercible = object | NonNullishPrimitive; type Primitive = Nullish | NonNullishPrimitive; type Concatable = T | T[]; type Value = Concatable; -export type arrayToObject = (source: Value[], options?: UtilOptionsInternal) => object; -export type assign = (target: object, source: object) => /* target */ object; -type queueObject = { - [key: string]: Concatable, -}; -type queueItem = { - obj: queueObject, - prop: keyof queueObject, -}; -export type compactQueue = (queue: queueItem[]) => void; -export type compact = (value: ObjectCoercible) => ObjectCoercible; -export type isBuffer = (obj: (Buffer | Value) & ({ constructor?: typeof Buffer })) => boolean; -export type isRegExp = (obj: RegExp | Value) => boolean; -export type merge = ( - target: ObjectIndexable[] | Object, - source?: ObjectCoercible, - options?: UtilOptionsInternal, -) => /* target | */ object; - -export type utils = { - arrayToObject: arrayToObject, - assign: assign, - compact: compact, - decode: Decoder, - encode: Encoder, - isBuffer: isBuffer, - isRegExp: isRegExp, - merge: merge, -} - -export type DateSerializer = (date: Date) => string | number; - -export type StringifyOptionsInternal = UtilOptions & { - arrayFormat: ArrayFormat, - charsetSentinel: boolean, - delimiter: string | RegExp, - encode: boolean, - encoder: Encoder, - encodeValuesOnly: boolean, - filter: Filter | Array - format: Format, - serializeDate: DateSerializer, - skipNulls: boolean, - sort: Comparator, - strictNullHandling: boolean, -}; - -export type StringifyOptions = Partial & { - encoder?: Encoder | null, - addQueryPrefix?: boolean, - indices?: boolean, -}; - -export type Stringify = (object: ObjectIndexable | Nullish, opts?: StringifyOptions) => string; - -export type StringifyInternal = ( - object: Value, - prefix: string, - generateArrayPrefix: arrayPrefixGenerator, - strictNullHandling: boolean, - skipNulls: boolean, - encoder: Encoder, - filter: Filter, - sort: Comparator, - allowDots: boolean, - serializeDate: DateSerializer, - formatter: Formatter, - encodeValuesOnly: boolean, - charset: Charset, -) => Concatable; - -export type InterpretNumericEntities = (str: string) => string; - -export type ParseOptionsInternal = UtilOptions & { - allowPrototypes: boolean, - arrayLimit: number, - charsetSentinel: boolean, - decoder: Decoder, - delimiter: string | RegExp, - depth: number, - ignoreQueryPrefix: boolean, - interpretNumericEntities: InterpretNumericEntities | undefined, - parameterLimit: number, - parseArrays: boolean, - strictNullHandling: boolean, -}; - -export type ParseOptions = Partial & { - decoder?: Decoder, -}; - -export type Parse = ( - str: object | string | Nullish, - opts?: ParseOptions, -) => object | Array; +type NonPrimitive = object; diff --git a/lib/stringify.d.ts b/lib/stringify.d.ts deleted file mode 100644 index 5dfd809e..00000000 --- a/lib/stringify.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Stringify } from './qs'; - -export = Stringify; diff --git a/lib/stringify.js b/lib/stringify.js index 8e341bdf..11c4bd6d 100644 --- a/lib/stringify.js +++ b/lib/stringify.js @@ -1,15 +1,56 @@ 'use strict'; - -/** @typedef {import('./qs').Charset} Charset */ -/** @typedef {import('./qs').DateSerializer} DateSerializer */ -/** @typedef {import('./qs').ArrayFormat} ArrayFormat */ -/** @typedef {import('./qs').StringifyOptions} StringifyOptions */ -/** @typedef {import('./qs').StringifyOptionsInternal} StringifyOptionsInternal */ +/** @typedef {import('./utils').UtilOptions} UtilOptions */ +/** @typedef {import('./utils').Encoder} Encoder */ +/** @typedef {import('./utils').Charset} Charset */ + +/** + * @template T + * @callback Filter + * @param {string} prefix + * @param {T} obj + * @returns T + */ + /** + * @callback Comparator + * + * @param {Value} a + * @param {Value} b + * @returns {number} + */ +/** @callback DateSerializer + * @param {Date} date + * @returns {string | number} + */ +/** @typedef {'brackets' | 'indices' | 'repeat'} ArrayFormat */ +/** @typedef StringifyOptionsInternalType + * + * @property {ArrayFormat} arrayFormat + * @property {boolean} charsetSentinel + * @property {string} delimiter + * @property {boolean} encode + * @property {Encoder} encoder + * @property {boolean} encodeValuesOnly + * @property {Filter | Array} filter + * @property {import('./formats').Format} format + * @property {DateSerializer} serializeDate + * @property {boolean} skipNulls + * @property {Comparator} sort + * @property {boolean} strictNullHandling + */ +/** @typedef {UtilOptions & StringifyOptionsInternalType} StringifyOptionsInternal */ + /** @typedef StringifyOptionsType + * + * @property {(Encoder | null)=} encoder + * @property {boolean=} addQueryPrefix + * @property {boolean=} indices + */ +/** @typedef {Partial & StringifyOptionsType} StringifyOptions */ var utils = require('./utils'); var formats = require('./formats'); -/** @type {import('./qs').arrayPrefixGenerators} */ +/** @typedef {(prefix: string, key?: string) => string} ArrayPrefixGenerator */ +/** @type {{ [format in ArrayFormat]: ArrayPrefixGenerator }} */ var arrayPrefixGenerators = { brackets: function brackets(prefix) { // eslint-disable-line func-name-matching return prefix + '[]'; @@ -24,7 +65,7 @@ var arrayPrefixGenerators = { var toISO = Date.prototype.toISOString; -/** @type {StringifyOptions & Pick} */ +/** @type {StringifyOptions & Pick} */ var defaults = { addQueryPrefix: false, allowDots: false, @@ -44,8 +85,22 @@ var defaults = { skipNulls: false, strictNullHandling: false }; - -/** @type {import('./qs').StringifyInternal} */ +/** + * @param {Value} object + * @param {string | number} prefix + * @param {ArrayPrefixGenerator} generateArrayPrefix + * @param {boolean | undefined} strictNullHandling + * @param {boolean | undefined} skipNulls + * @param {Encoder | null} encoder + * @param {Filter | Array | undefined} filter + * @param {Comparator | null} sort + * @param {boolean} allowDots + * @param {DateSerializer} serializeDate + * @param {import('./formats').Formatter} formatter + * @param {boolean | undefined} encodeValuesOnly + * @param {Charset} charset + * @returns {Concatable} +*/ var stringify = function stringify( // eslint-disable-line func-name-matching object, prefix, @@ -61,6 +116,7 @@ var stringify = function stringify( // eslint-disable-line func-name-matching encodeValuesOnly, charset ) { + prefix = '' + prefix; /** @type {string | number | boolean | Buffer | undefined | object} */ var obj = object; if (typeof filter === 'function') { @@ -99,7 +155,7 @@ var stringify = function stringify( // eslint-disable-line func-name-matching } for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; + var key = '' + objKeys[i]; if (skipNulls && obj[key] === null) { continue; @@ -145,8 +201,12 @@ var stringify = function stringify( // eslint-disable-line func-name-matching return values; }; -/** @type {import('./qs').Stringify} */ +/** + * @param {ObjectCoercible | Nullish} object + * @param {StringifyOptions} [opts] + */ module.exports = function (object, opts) { + /** @type {StringifyOptions} */ var options = opts ? utils.assign({}, opts) : {}; if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') { @@ -196,7 +256,7 @@ module.exports = function (object, opts) { /** @type {ArrayFormat} */ var arrayFormat; - if (options.arrayFormat in arrayPrefixGenerators) { + if (options.arrayFormat && options.arrayFormat in arrayPrefixGenerators) { arrayFormat = options.arrayFormat; } else if ('indices' in options) { arrayFormat = options.indices ? 'indices' : 'repeat'; diff --git a/lib/utils.d.ts b/lib/utils.d.ts deleted file mode 100644 index a3f14672..00000000 --- a/lib/utils.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { utils } from './qs'; - -export = utils; diff --git a/lib/utils.js b/lib/utils.js index 6d66265f..942ce085 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,4 +1,39 @@ 'use strict'; +/** @typedef {'iso-8859-1' | 'utf-8'} Charset */ + +/** @callback Decoder + * + * @param {string} str + * @param {Decoder} defaultDecoder + * @param {Charset} charset + * @returns {string} + */ + +/** @callback Encoder + * + * @param {string | Buffer} str + * @param {Encoder} defaultEncoder + * @param {Charset=} charset + * @returns {string | Buffer} + */ + +/** @typedef UtilOptionsInternalType + * + * @property {boolean} allowPrototypes + * @property {number} arrayLimit + * + * @typedef {UtilOptions & UtilOptionsInternalType} UtilOptionsInternal + */ + +/** @typedef UtilOptions + * + * @property {boolean} allowDots + * @property {Charset} charset + * @property {boolean} plainObjects + */ + +/** @typedef {Object>} QueueObject */ +/** @typedef {{ obj: QueueObject, prop: keyof QueueObject }} QueueItem */ var has = Object.prototype.hasOwnProperty; @@ -11,7 +46,10 @@ var hexTable = (function () { return array; }()); -/** @type {import('./qs').compactQueue} */ +/** + * @param {QueueItem[]} queue + * @returns {void} + */ var compactQueue = function compactQueue(queue) { while (queue.length > 1) { var item = queue.pop(); @@ -32,7 +70,11 @@ var compactQueue = function compactQueue(queue) { } }; -/** @type {import('./qs').arrayToObject} */ +/** + * @param {Value[]} source + * @param {UtilOptionsInternal} [options] + * @returns {object} + */ var arrayToObject = function arrayToObject(source, options) { var obj = options && options.plainObjects ? Object.create(null) : {}; for (var i = 0; i < source.length; ++i) { @@ -44,7 +86,12 @@ var arrayToObject = function arrayToObject(source, options) { return obj; }; -/** @type {import('./qs').merge} */ +/** + * @param {ObjectCoercible[] | object} target + * @param {ObjectCoercible} [source] + * @param {UtilOptionsInternal} [options] + * @returns {object} maybe should be typeof target & object. + */ var merge = function merge(target, source, options) { if (!source) { return target; @@ -53,7 +100,7 @@ var merge = function merge(target, source, options) { if (typeof source !== 'object') { if (Array.isArray(target)) { target.push(source); - } else if (typeof target === 'object') { + } else if (typeof target === 'object' && typeof source !== "boolean") { if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { target[source] = true; } @@ -64,10 +111,6 @@ var merge = function merge(target, source, options) { return target; } - if (typeof target !== 'object') { - return [target].concat(source); - } - var mergeTarget = target; if (Array.isArray(target) && !Array.isArray(source)) { mergeTarget = arrayToObject(target, options); @@ -76,8 +119,9 @@ var merge = function merge(target, source, options) { if (Array.isArray(target) && Array.isArray(source)) { source.forEach(function (item, i) { if (has.call(target, i)) { - if (target[i] && typeof target[i] === 'object') { - target[i] = merge(target[i], item, options); + var tmp = target[i]; // narrowing by element access failed here + if (tmp && typeof tmp === 'object') { + target[i] = merge(tmp, item, options); } else { target.push(item); } @@ -100,7 +144,11 @@ var merge = function merge(target, source, options) { }, mergeTarget); }; -/** @type {import('./qs').assign} */ +/** + * @param {object} target + * @param {object} source + * @returns object - should probably be `typeof target & object` + */ var assign = function assignSingleSource(target, source) { return Object.keys(source).reduce(function (acc, key) { acc[key] = source[key]; @@ -108,7 +156,7 @@ var assign = function assignSingleSource(target, source) { }, target); }; -/** @type {import('./qs').Decoder} */ +/** @type {Decoder} */ var decode = function (str, defaultDecoder, charset) { var strWithoutPlus = str.replace(/\+/g, ' '); if (charset === 'iso-8859-1') { @@ -123,7 +171,7 @@ var decode = function (str, defaultDecoder, charset) { } }; -/** @type {import('./qs').Encoder} */ +/** @type {Encoder} */ var encode = function encode(str, defaultEncoder, charset) { // This code was originally written by Brian White (mscdex) for the io.js core querystring library. // It has been adapted here for stricter adherence to RFC 3986 @@ -182,8 +230,12 @@ var encode = function encode(str, defaultEncoder, charset) { return out; }; -/** @type {import('./qs').compact} */ +/** + * @param {object} value + * @returns {object} + */ var compact = function compact(value) { + /** @type {QueueItem[]} */ var queue = [{ obj: { o: value }, prop: 'o' }]; var refs = []; @@ -196,7 +248,7 @@ var compact = function compact(value) { var key = keys[j]; var val = obj[key]; if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { - queue.push({ obj: obj, prop: key }); + queue.push({ obj: /** @type {{ [key: string]: object}} */(obj), prop: key }); refs.push(val); } } @@ -207,12 +259,18 @@ var compact = function compact(value) { return value; }; -/** @type {import('./qs').isRegExp} */ +/** + * @param {RegExp | Value} obj + * @returns boolean + */ var isRegExp = function isRegExp(obj) { return Object.prototype.toString.call(obj) === '[object RegExp]'; }; -/** @type {import('./qs').isBuffer} */ +/** + * @param {(Buffer | Value) & ({ constructor?: typeof Buffer })} obj + * @returns boolean + */ var isBuffer = function isBuffer(obj) { if (obj === null || typeof obj === 'undefined') { return false; @@ -221,7 +279,6 @@ var isBuffer = function isBuffer(obj) { return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); }; -/** @type {import('./qs').utils} */ module.exports = { arrayToObject: arrayToObject, assign: assign, diff --git a/test/parse.js b/test/parse.js index fde54d00..696e3a10 100644 --- a/test/parse.js +++ b/test/parse.js @@ -1,6 +1,6 @@ 'use strict'; -/** @typedef {import('../lib/qs').Decoder} Decoder */ +/** @typedef {import('../lib/utils').Decoder} Decoder */ var test = require('tape'); var qs = require('../'); @@ -310,10 +310,12 @@ test('parse()', function (t) { }); t.test('allows disabling array parsing', function (st) { + /** @type {*} */ var indices = qs.parse('a[0]=b&a[1]=c', { parseArrays: false }); st.deepEqual(indices, { a: { 0: 'b', 1: 'c' } }); st.equal(Array.isArray(indices.a), false, 'parseArrays:false, indices case is not an array'); + /** @type {*} */ var emptyBrackets = qs.parse('a[]=b', { parseArrays: false }); st.deepEqual(emptyBrackets, { a: { 0: 'b' } }); st.equal(Array.isArray(emptyBrackets.a), false, 'parseArrays:false, empty brackets case is not an array'); @@ -446,6 +448,7 @@ test('parse()', function (t) { a.b = 'c'; st.deepEqual(qs.parse(a), { b: 'c' }); + /** @type {*} */ var result = qs.parse({ a: a }); st.equal('a' in result, true, 'result has "a" property'); st.deepEqual(result.a, a); diff --git a/test/stringify.js b/test/stringify.js index 3b657759..931bd2b1 100644 --- a/test/stringify.js +++ b/test/stringify.js @@ -1,8 +1,8 @@ 'use strict'; -/** @typedef {import('../lib/qs').Filter<*>} Filter */ -/** @typedef {import('../lib/qs').Encoder} Encoder */ -/** @typedef {import('../lib/qs').DateSerializer} DateSerializer */ +/** @typedef {import('../lib/stringify').Filter<*>} Filter */ +/** @typedef {import('../lib/stringify').Encoder} Encoder */ +/** @typedef {import('../lib/stringify').DateSerializer} DateSerializer */ var test = require('tape'); /** @type {import('../')} */ @@ -427,7 +427,7 @@ test('stringify()', function (t) { }); t.test('can sort the keys', function (st) { - /** @type {import('../lib/qs').Comparator} */ + /** @type {import('../lib/stringify').Comparator} */ var sort = function (a, b) { return String(a).localeCompare(String(b)); }; @@ -437,7 +437,7 @@ test('stringify()', function (t) { }); t.test('can sort the keys at depth 3 or more too', function (st) { - /** @type {import('../lib/qs').Comparator} */ + /** @type {import('../lib/stringify').Comparator} */ var sort = function (a, b) { return String(a).localeCompare(String(b)); }; diff --git a/tsconfig.json b/tsconfig.json index 3f919d43..8d9efd87 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "module": "commonjs", + "target": "esnext", "noEmit": true, "esModuleInterop": true, "allowJs": true,