Skip to content

Commit 2125355

Browse files
committed
Merge tag 'v1.22.0'
1.22.0
2 parents 6c2fd1a + 200f20e commit 2125355

72 files changed

Lines changed: 2032 additions & 674 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
# Changelog
22

3+
## 1.22.0
4+
5+
- Added support for `Number.isInteger(n)`
6+
- Added support for `afterEmit` plugin hook that can be used to post-process lua files after (possibly incremental) builds
7+
- Fixed a bug causing `@noSelfInFile` sometimes to be ignored
8+
9+
## 1.21.0
10+
11+
- Added support for `continue` for Lua 5.0, 5.1 and universal targets.
12+
- Added support for the new `/** @customName myCustomName **/` decorator, which allows renaming of variables and identifiers.
13+
- This is useful to get around names that are reserved keywords in TypeScript, but are used in Lua API
14+
- Fixed a bug that caused super calls in static methods to throw an error
15+
16+
## 1.20.0
17+
18+
- Added support for `Number.parseInt` and `Number.parseFloat` (mapped to same implementation as global `parseInt` and `parseFloat`)
19+
- Added implementation for multiple `Number` constants like `Number.EPSILON`
20+
- Added support for `Array.at`
21+
- Fixed a bug when throwing an error object in a Lua environment without `debug` module
22+
- Fixed a bug causing files not to be found when returning an absolute path from a `moduleResolution` plugin
23+
24+
## 1.19.0
25+
26+
- Added support for the new TypeScript 5.2 `using` keyword for explicit resource management. See the [TypeScript release notes](https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/#using-declarations-and-explicit-resource-management) for more information.
27+
- Added support for the newly introduced 'copying array methods' `toReversed`, `toSorted`, `toSpliced` and `with`. These were also introduced in TypeScript 5.2, see [their release notes](https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/#copying-array-methods) for more information.
28+
29+
## 1.18.0
30+
31+
- Upgraded TypeScript to 5.2.2
32+
- The `noResolvePaths` option now accepts glob paths (for example, 'mydir/hello\*' to not resolve any files in mydir starting with hello).
33+
- This also allows disabling module resolution completely by providing a '\*\*' pattern in your tsconfig.json `noResolvePaths`.
34+
35+
## 1.17.0
36+
37+
- Added the `moduleResolution` plugin, allowing you to provide custom module resolution logic. See [the docs](https://typescripttolua.github.io/docs/api/plugins#moduleresolution) for more info.
38+
- Added `isEmpty` to `LuaTable`, `LuaMap` and `LuaSet` (and their read-only counterparts). This simply to `next(tbl) == nil`, allowing for a simple check to see if a table is empty or not.
39+
- Fixed a bug with synthetic nodes (e.g. created by custom TypeScript transformers) throwing an exception.
40+
- Fixed unnecessary extra unpacking of tables
41+
- Fixed some bugs with new decorators
42+
343
## 1.16.0
444

545
- Upgraded TypeScript to 5.1.3.

language-extensions/index.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,20 @@ declare type LuaTableDelete<TTable extends AnyTable, TKey extends AnyNotNil> = (
562562
declare type LuaTableDeleteMethod<TKey extends AnyNotNil> = ((key: TKey) => boolean) &
563563
LuaExtension<"TableDeleteMethod">;
564564

565+
/**
566+
* Calls to functions with this type are translated to `next(myTable) == nil`.
567+
* For more information see: https://typescripttolua.github.io/docs/advanced/language-extensions
568+
*
569+
* @param TTable The type to access as a Lua table.
570+
*/
571+
declare type LuaTableIsEmpty<TTable extends AnyTable> = ((table: TTable) => boolean) & LuaExtension<"TableIsEmpty">;
572+
573+
/**
574+
* Calls to methods with this type are translated to `next(myTable) == nil`, where `table` is the object with the method.
575+
* For more information see: https://typescripttolua.github.io/docs/advanced/language-extensions
576+
*/
577+
declare type LuaTableIsEmptyMethod = (() => boolean) & LuaExtension<"TableIsEmptyMethod">;
578+
565579
/**
566580
* A convenience type for working directly with a Lua table.
567581
* For more information see: https://typescripttolua.github.io/docs/advanced/language-extensions
@@ -575,6 +589,7 @@ declare interface LuaTable<TKey extends AnyNotNil = AnyNotNil, TValue = any> ext
575589
set: LuaTableSetMethod<TKey, TValue>;
576590
has: LuaTableHasMethod<TKey>;
577591
delete: LuaTableDeleteMethod<TKey>;
592+
isEmpty: LuaTableIsEmptyMethod;
578593
}
579594

580595
/**
@@ -612,6 +627,7 @@ declare interface LuaMap<K extends AnyNotNil = AnyNotNil, V = any> extends LuaPa
612627
set: LuaTableSetMethod<K, V>;
613628
has: LuaTableHasMethod<K>;
614629
delete: LuaTableDeleteMethod<K>;
630+
isEmpty: LuaTableIsEmptyMethod;
615631
}
616632

617633
/**
@@ -633,6 +649,7 @@ declare const LuaMap: (new <K extends AnyNotNil = AnyNotNil, V = any>() => LuaMa
633649
declare interface ReadonlyLuaMap<K extends AnyNotNil = AnyNotNil, V = any> extends LuaPairsIterable<K, V> {
634650
get: LuaTableGetMethod<K, V | undefined>;
635651
has: LuaTableHasMethod<K>;
652+
isEmpty: LuaTableIsEmptyMethod;
636653
}
637654

638655
/**
@@ -645,6 +662,7 @@ declare interface LuaSet<T extends AnyNotNil = AnyNotNil> extends LuaPairsKeyIte
645662
add: LuaTableAddKeyMethod<T>;
646663
has: LuaTableHasMethod<T>;
647664
delete: LuaTableDeleteMethod<T>;
665+
isEmpty: LuaTableIsEmptyMethod;
648666
}
649667

650668
/**
@@ -662,6 +680,7 @@ declare const LuaSet: (new <T extends AnyNotNil = AnyNotNil>() => LuaSet<T>) & L
662680
*/
663681
declare interface ReadonlyLuaSet<T extends AnyNotNil = AnyNotNil> extends LuaPairsKeyIterable<T> {
664682
has: LuaTableHasMethod<T>;
683+
isEmpty: LuaTableIsEmptyMethod;
665684
}
666685

667686
interface ObjectConstructor {

language-extensions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typescript-to-lua/language-extensions",
3-
"version": "1.0.0",
3+
"version": "1.19.0",
44
"description": "Language extensions used by typescript-to-lua",
55
"repository": "https://github.com/TypeScriptToLua/TypeScriptToLua",
66
"homepage": "https://typescripttolua.github.io/",

0 commit comments

Comments
 (0)