Skip to content

Commit

Permalink
In BundleTransformer.TypeScript added support of the TypeScript versi…
Browse files Browse the repository at this point in the history
…on 5.3 RTM
  • Loading branch information
Taritsyn committed Nov 26, 2023
1 parent c7f86c7 commit adff569
Show file tree
Hide file tree
Showing 45 changed files with 4,425 additions and 3,522 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "7.0.402"
"version": "8.0.100"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
<Import Project="../../build/nuget-for-dotnet-lib.props" />

<PropertyGroup>
<Description>BundleTransformer.TypeScript contains one translator-adapter - `TypeScriptTranslator` (supports the TypeScript (https://www.typescriptlang.org) version 5.2 RTM). This adapter makes translation of TypeScript code to JS code. Also contains the `TypeScriptAssetHandler` debugging HTTP handler, which is responsible for text output of translated TypeScript asset.
<Description>BundleTransformer.TypeScript contains one translator-adapter - `TypeScriptTranslator` (supports the TypeScript (https://www.typescriptlang.org) version 5.3 RTM). This adapter makes translation of TypeScript code to JS code. Also contains the `TypeScriptAssetHandler` debugging HTTP handler, which is responsible for text output of translated TypeScript asset.

BundleTransformer.TypeScript does not support external modules (CommonJS, AMD, SystemJS, UMD and ES6 modules).

As a JS engine is used the JavaScript Engine Switcher library (https://github.com/Taritsyn/JavaScriptEngineSwitcher). For correct working of this module, you need to install one of the following NuGet packages: JavaScriptEngineSwitcher.Msie, JavaScriptEngineSwitcher.V8 or JavaScriptEngineSwitcher.ChakraCore.</Description>
<PackageIconUrl>https://raw.githubusercontent.com/Taritsyn/BundleTransformer/master/images/icons/128/BundleTransformer_TypeScript_Logo_128x128.png</PackageIconUrl>
<PackageIconFullPath>../../images/icons/128/BundleTransformer_TypeScript_Logo_128x128.png</PackageIconFullPath>
<PackageTags>$(PackageCommonTags);JavaScript;JS;Bundling;TypeScript;Translation;Translator;Compilation;Compiler</PackageTags>
<PackageReleaseNotes>Added support for the TypeScript version 5.2 RTM (please note: The 5.2 RTM release is also called '5.2.2').</PackageReleaseNotes>
<PackageReleaseNotes>Added support for the TypeScript version 5.3 RTM (please note: The 5.3 RTM release is also called '5.3.2').</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,18 @@ type ClassMemberDecoratorContext =
| ClassGetterDecoratorContext
| ClassSetterDecoratorContext
| ClassFieldDecoratorContext
| ClassAccessorDecoratorContext
;
| ClassAccessorDecoratorContext;

/**
* The decorator context types provided to any decorator.
*/
type DecoratorContext =
| ClassDecoratorContext
| ClassMemberDecoratorContext
;
| ClassMemberDecoratorContext;

type DecoratorMetadataObject = Record<PropertyKey, unknown> & object;

type DecoratorMetadata =
typeof globalThis extends { Symbol: { readonly metadata: symbol } } ? DecoratorMetadataObject : DecoratorMetadataObject | undefined;
type DecoratorMetadata = typeof globalThis extends { Symbol: { readonly metadata: symbol; }; } ? DecoratorMetadataObject : DecoratorMetadataObject | undefined;

/**
* Context provided to a class decorator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,7 @@ interface RTCInboundRtpStreamStats extends RTCReceivedRtpStreamStats {
keyFramesDecoded?: number;
kind: string;
lastPacketReceivedTimestamp?: DOMHighResTimeStamp;
mid?: string;
nackCount?: number;
packetsDiscarded?: number;
pliCount?: number;
Expand All @@ -1449,6 +1450,7 @@ interface RTCInboundRtpStreamStats extends RTCReceivedRtpStreamStats {
totalSamplesDuration?: number;
totalSamplesReceived?: number;
totalSquaredInterFrameDelay?: number;
trackIdentifier: string;
}

interface RTCLocalSessionDescriptionInit {
Expand Down Expand Up @@ -21843,7 +21845,9 @@ interface SubtleCrypto {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) */
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
exportKey(format: KeyFormat, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
generateKey(algorithm: "Ed25519", extractable: boolean, keyUsages: ReadonlyArray<"sign" | "verify">): Promise<CryptoKeyPair>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ and limitations under the License.
/// <reference no-default-lib="true"/>

interface Map<K, V> {

clear(): void;
/**
* @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
Expand Down Expand Up @@ -47,7 +46,7 @@ interface Map<K, V> {
}

interface MapConstructor {
new(): Map<any, any>;
new (): Map<any, any>;
new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
readonly prototype: Map<any, any>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,5 +553,5 @@ interface StringConstructor {
* @param template A well-formed template string call site representation.
* @param substitutions A set of substitution values.
*/
raw(template: { raw: readonly string[] | ArrayLike<string>}, ...substitutions: any[]): string;
raw(template: { raw: readonly string[] | ArrayLike<string>; }, ...substitutions: any[]): string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ interface ReadonlyMap<K, V> {
}

interface MapConstructor {
new(): Map<any, any>;
new (): Map<any, any>;
new <K, V>(iterable?: Iterable<readonly [K, V]> | null): Map<K, V>;
}

interface WeakMap<K extends WeakKey, V> { }
interface WeakMap<K extends WeakKey, V> {}

interface WeakMapConstructor {
new <K extends WeakKey, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>;
Expand Down Expand Up @@ -207,13 +207,13 @@ interface SetConstructor {
new <T>(iterable?: Iterable<T> | null): Set<T>;
}

interface WeakSet<T extends WeakKey> { }
interface WeakSet<T extends WeakKey> {}

interface WeakSetConstructor {
new <T extends WeakKey = WeakKey>(iterable: Iterable<T>): WeakSet<T>;
}

interface Promise<T> { }
interface Promise<T> {}

interface PromiseConstructor {
/**
Expand Down Expand Up @@ -315,7 +315,6 @@ interface Uint8ClampedArray {
interface Uint8ClampedArrayConstructor {
new (elements: Iterable<number>): Uint8ClampedArray;


/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;
all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>;

// see: lib.es2015.iterable.d.ts
// all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ interface SymbolConstructor {
keyFor(sym: symbol): string | undefined;
}

declare var Symbol: SymbolConstructor;
declare var Symbol: SymbolConstructor;
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ interface Float64Array {
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ and limitations under the License.
/// <reference no-default-lib="true"/>

/// <reference lib="es2015" />
/// <reference lib="es2016.array.include" />
/// <reference lib="es2016.array.include" />
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ and limitations under the License.
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.iterable" />
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ and limitations under the License.
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.iterable" />
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ and limitations under the License.
/// <reference no-default-lib="true"/>

declare namespace Intl {

interface DateTimeFormatPartTypesRegistry {
day: any
dayPeriod: any
era: any
hour: any
literal: any
minute: any
month: any
second: any
timeZoneName: any
weekday: any
year: any
day: any;
dayPeriod: any;
era: any;
hour: any;
literal: any;
minute: any;
month: any;
second: any;
timeZoneName: any;
weekday: any;
year: any;
}

type DateTimeFormatPartTypes = keyof DateTimeFormatPartTypesRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface ObjectConstructor {
* Returns an array of values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
values<T>(o: { [s: string]: T } | ArrayLike<T>): T[];
values<T>(o: { [s: string]: T; } | ArrayLike<T>): T[];

/**
* Returns an array of values of the enumerable properties of an object
Expand All @@ -33,7 +33,7 @@ interface ObjectConstructor {
* Returns an array of key/values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
entries<T>(o: { [s: string]: T } | ArrayLike<T>): [string, T][];
entries<T>(o: { [s: string]: T; } | ArrayLike<T>): [string, T][];

/**
* Returns an array of key/values of the enumerable properties of an object
Expand All @@ -45,5 +45,5 @@ interface ObjectConstructor {
* Returns an object containing all own property descriptors of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
getOwnPropertyDescriptors<T>(o: T): {[P in keyof T]: TypedPropertyDescriptor<T[P]>} & { [x: string]: PropertyDescriptor };
getOwnPropertyDescriptors<T>(o: T): { [P in keyof T]: TypedPropertyDescriptor<T[P]>; } & { [x: string]: PropertyDescriptor; };
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ interface AsyncIterable<T> {

interface AsyncIterableIterator<T> extends AsyncIterator<T> {
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ and limitations under the License.
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.iterable" />
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ and limitations under the License.
/// <reference no-default-lib="true"/>

declare namespace Intl {

// http://cldr.unicode.org/index/cldr-spec/plural-rules#TOC-Determining-Plural-Categories
type LDMLPluralRule = "zero" | "one" | "two" | "few" | "many" | "other";
type PluralRuleType = "cardinal" | "ordinal";
Expand Down Expand Up @@ -52,7 +51,7 @@ declare namespace Intl {
new (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
(locales?: string | string[], options?: PluralRulesOptions): PluralRules;

supportedLocalesOf(locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit" }): string[];
supportedLocalesOf(locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[];
};

// We can only have one definition for 'type' in TypeScript, and so you can learn where the keys come from here:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ interface Promise<T> {
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
* @returns A Promise for the completion of the callback.
*/
finally(onfinally?: (() => void) | undefined | null): Promise<T>
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ and limitations under the License.

interface RegExpMatchArray {
groups?: {
[key: string]: string
}
[key: string]: string;
};
}

interface RegExpExecArray {
groups?: {
[key: string]: string
}
[key: string]: string;
};
}

interface RegExp {
Expand All @@ -34,4 +34,4 @@ interface RegExp {
* Default is false. Read-only.
*/
readonly dotAll: boolean;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ and limitations under the License.
/// <reference no-default-lib="true"/>

type FlatArray<Arr, Depth extends number> = {
"done": Arr,
"recur": Arr extends ReadonlyArray<infer InnerArr>
? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
: Arr
done: Arr;
recur: Arr extends ReadonlyArray<infer InnerArr> ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
: Arr;
}[Depth extends -1 ? "done" : "recur"];

interface ReadonlyArray<T> {

/**
* Calls a defined callback function on each element of an array. Then, flattens the result into
* a new array.
Expand All @@ -35,11 +33,10 @@ interface ReadonlyArray<T> {
* @param thisArg An object to which the this keyword can refer in the callback function. If
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined> (
flatMap<U, This = undefined>(
callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,
thisArg?: This
): U[]

thisArg?: This,
): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
Expand All @@ -49,12 +46,11 @@ interface ReadonlyArray<T> {
*/
flat<A, D extends number = 1>(
this: A,
depth?: D
): FlatArray<A, D>[]
}
depth?: D,
): FlatArray<A, D>[];
}

interface Array<T> {

/**
* Calls a defined callback function on each element of an array. Then, flattens the result into
* a new array.
Expand All @@ -65,10 +61,10 @@ interface Array<T> {
* @param thisArg An object to which the this keyword can refer in the callback function. If
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined> (
flatMap<U, This = undefined>(
callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,
thisArg?: This
): U[]
thisArg?: This,
): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
Expand All @@ -78,6 +74,6 @@ interface Array<T> {
*/
flat<A, D extends number = 1>(
this: A,
depth?: D
): FlatArray<A, D>[]
depth?: D,
): FlatArray<A, D>[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ and limitations under the License.

declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
unknown: any
unknown: any;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface ObjectConstructor {
* Returns an object created by key-value entries for properties and methods
* @param entries An iterable object that contains key-value entries for properties and methods.
*/
fromEntries<T = any>(entries: Iterable<readonly [PropertyKey, T]>): { [k: string]: T };
fromEntries<T = any>(entries: Iterable<readonly [PropertyKey, T]>): { [k: string]: T; };

/**
* Returns an object created by key-value entries for properties and methods
Expand Down
Loading

0 comments on commit adff569

Please sign in to comment.