- Fix an edge case in String.charCodeAt introduced in 1.2.2
- Optimize charCodeAt by removing an iterations over all codepoints in the input string.
- 🛠️ Error and AssertionError use global suffix (#178)
- add
flat
toArray
type - add
flatMap
toArray
type
- slightly optimize
instanceof
loop detection - Export Symbol from a separate repo to work around rotriever limitations, reduce total available versions for Symbol, and keep the global registry working.
- Fix lint in
Map
implementation around type ofnext
- When
__DEV__
global is true, the Map object will no longer overflow the C stack when you access a field on it after incorrectly calling table.clear(). It now asserts with actionable information. - the
Map
constructor will now correctly take aMap
, cloning the keys and values correctly. Map.new
will now include more information that more closely matches JS standards when given invalid arguments.- Add
Error.__recalculateStacktrace
static method to allow recalculating of the previously captured stacktrace to account for possibly newmessage
andname
- Add WeakMap type to ES7Types package
- Replace custom implementation of
Math.countlz
with the new enginebit32.countlz
function - Fix
indexOf
to be accessible fromString
- Refactor structure to a rotriever workspace
- Fix Error stacktrace to include error name and message
- add
indexOf
method toString
type
- add
includes
method toString
type
- restructured some internals to avoid circular dependency issues
- fix
WeakMap
typing - distinguish private and public API
- add
getStatus
andawaitStatus
methods toPromise
type
- Use Luau's generalized iteration feature where possible, resulting in up to 50% better benchmark performance in some scenarios.
- Runtime optimizations to avoid empty table assignments unnecessarily, using the faster table.clone() when convenient.
Array.findIndex
will now typecheck the predicate function to ensure types match the suppliedArray<T>
Array.reduce
will now typecheck the predicate function and initial values to ensure types match the suppliedArray<>
Array.from
will now type the return value correctly when a map function parameter is omitted. Until Luau adds better support for function overloads, you may now need to manually annotate the return value in some scenarios.Array.includes
andArray.indexOf
will now typecheck the searched element is the same type as the supplied containingArray<>
Array.reverse
,Array.splice
,Array.sort
,Array.shift
,Array.unshift
will no longer erase the element type of the suppliedArray<>
AssertionError.new
no longer requires theoperation
field, and theAssertionError
instance field is now nil-able, matching upstream nodejs.Object.entries
andObject.values
now returns a more specifically-typedArray<>
based on the supplied ObjectObject.freeze
andObject.seal
should now retain more type fidelity of the input parameter to the return valueMap
,WeakMap
, andSet
exported tables are now strongly-typed, which mostly aids typechecking of the backing implementation detail.WeakMap.new
is now generic, so the return value can be force-cast to specific Key and Value types by users.String.split
now accepts alimit
parameter, to limit the number of split strings returned.String.split
will now escape Lua pattern match characters in thepattern
parameter, allowing for splitting on%
and.
characters.String.split
behavior now matches JavaScript when passed an empty pattern.clearTimeout
andclearInterval
will no longer crash when givennil
, and just be a no-op.
Map<>:ipairs()
andSet<>:ipairs()
will be removed in a future version of the library, in favor of the significantly better-performing__iter
metamethod. Please migrate your loops that use these methods to instead used the generalized iteration approach:
for key, value in myMap do
end
- add
await
method toPromise
- add multi-return support for
Promise.expect
- implement
AssertionError
- implement
setInterval
andclearInterval
- implement
encodeURIComponent
, integration tested in Apollo GraphQL project
Symbol
is now typed to returnany
when indexed with a string, allowing code usingSymbol.species
and the like to type check without casts in the library consumer code.
inspect
now accepts an optional options table with a depth option, which defaults to2
.Array.concat
will now accept a non-array as the first parameter, matching theArray.prototype.concat
behavior from JavaScript, and relied upon by React 17'suseImperativeHandle
tests.Array.sort
will now acceptObject.None
(our equivalent of JS'undefined
) for the comparator and use the default sort.- the default sort in
Array.sort
now uses a more durable implementation, taking into account thetype()
andtostring()
.
- strongly type
Set.new
, which allows Luau analysis to catch many new classes of issues. IfSet.new
is used without arguments, theT
in theSet<T>
return type cannot be inferred and may result in new analyze warnings. You will now need to add a typecheck operator:local interactions = Set.new() :: Set<string>
- strongly type
Map.new
, which allows Luau analysis to catch many new classes of issues. IfMap.new
is used without arguments, theK
andV
in theMap<K, V>
return type cannot be inferred and may result in new analyze warnings. You will now need to add a typecheck operator:local myMap = Map.new() :: Map<string, MyType>
Array.concat
was incorrectly modeled in terms of functionality and types. The first argument now must be anArray<>
, it will type check the arguments, and retain the appropriate types in the return value.
Object.freeze
now usestable.freeze
- add
isFrozen
method toObject
- Strict luau type mode enabled on almost all polyfill files and tests. This may highlight latent type issues in code that consumes the polyfills.
setTimeout
now usestask.delay
as the default implementation, increasing timer resolution from 30hz to 60hz.toExponential
now returns "nan" when given invalid values, more closely matching MDN documentation and in-browser tests.
- add
forEach
method toSet
- add
forEach
method toMap
- add
isFrozen
method toObject
- add
debug
method toconsole
Array.forEach
will no longer incorrectly call the callback when the array length changes. The callback also is now more correctly typed.- the
Object
type exported no longer uses nil-able values, which works around some Luau inference issues, and better matches the typical intention of using it. Array.from
will now respect thethisArg
argument when it is supplied.Array.slice
andArray.filter
will no longer erase the type of theArray<>
being operated on.Object.assign
will now pass through more original information on source and target types. Uses where the target is an empty tableObject.assign({}, myTable, otherTable)
may require an explicit annotation on assignment to a local variable.
- add
has
method toWeakMap
- add
expect
method toPromise
- add
self
param toPromise
's methods
- Fix for
Array.sort
to make comparator argument optional - Tighten callback and predicate argument types for many Array methods:
every
,filter
,find
,foreach
, ... - Internal-only fix to satisfy type checker variant used by the roblox-cli
convert
command Array.join
will now calltostring()
on items before adding them
String.charCodeAt
,String.findOr
Array.includes
,Array.unshift
To be cached to the proxy with a Rotriever RC 4, which will properly filter tests when bundling the artifact.
- Fix for
Array.from
to supportMap
objects
Promise
type-only, translates relevant portion of Promise type from TypeScript and flowtype, and maps cleanly on top of community Promise libraries.Array.reverse
,Array.forEach
String.lastIndexOf
,String.substr
Object
typeError
type
- Fix for
instanceof
with objects that have a throwing__index
metamethod (#86) - Move spec file under
__tests__
to fix static analysis error (#85)
-
Object.keys
should return an empty array for sets (#71) -
Make third argument of
Array.map(array, callback, this)
optional (#77) -
Set
type - add self as first param to Set methods (#76) -
Override
__tostring
onSet
so that it prints the contents in a way that matches JS (#68) -
improvements to
util.inspect
(#68)- Print fragmented keys in addition to regular sequential indexes.
- We now explicitly sort the keys based on alpha-sort, for more stable string comparison in tests/snapshots.
- If a table overrides tostring, don't append all the raw keys/values.
- Mixed-index tables now inspect correctly.
String.split
String.slice
util.inspect
will now emit function names, and use the __tostring metamethod, when printing values, if either are availableSet.new
can now take another Set, and is now strongly typed to prevent abuse cases
Removes LuauPolyfill.RegExp
so that it can be selectively included as a separate dependency via https://github.com/roblox/luau-regexp.
String.startsWith
String.endsWith
util.inspect
from nodejs/luvit.io
- All
console
methods will now accept non-strings and print them usingutil.inspect
- Fix Array.reduce to use 1-based indexing (instead of starting from 0)
Error
object initializes with an empty string by default
- Remove
--!nonstrict
shebangs
- Add stacktrace to
Error
object - Fix infinite loop case for
instanceOf
- Fix
Set
typing error for newestroblox-cli
extends
instanceof
Array.concat()
Array.join
Error:extend()
removed, changed how inheritance is handled
Array.sort()
Error.new()
Error:extend()
- Fixed Luau type analysis regression in
TestMatchers
- Added a
__tostring
metamethod forRegExp
Array.every()
Array.filter()
Array.find()
Array.findIndex()
Array.from()
Array.indexOf()
Array.isArray()
Array.map()
Array.reduce()
Array.shift()
Array.slice()
Array.some()
Array.splice()
Boolean.toJSBoolean()
Console.makeConsoleImpl()
Error()
Math.clz32()
Number.isNaN()
Number.isInteger()
Number.isSafeInteger()
Number.MAX_SAFE_INTEGER
Number.MIN_SAFE_INTEGER
Number.toExponential()
Object.assign()
Object.entries()
Object.freeze()
Object.is()
Object.keys()
Object.preventExtensions()
Object.seal()
Object.values()
Object.None
RegExp()
RegExp():exec()
RegExp():test()
String.trim()
String.trimEnd()
String.trimStart()
String.trimRight()
String.trimLeft()
Symbol()
Symbol.for_()
TestMatchers.toEqual()
TestMatchers.toThrow()
Timers.clearTimeout()
Timers.setTimeout()