- Updated to support Wally publishing.
- 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
flattoArraytype - add
flatMaptoArraytype
- slightly optimize
instanceofloop 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
Mapimplementation 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
Mapconstructor will now correctly take aMap, cloning the keys and values correctly. Map.newwill now include more information that more closely matches JS standards when given invalid arguments.- Add
Error.__recalculateStacktracestatic method to allow recalculating of the previously captured stacktrace to account for possibly newmessageandname
- Add WeakMap type to ES7Types package
- Replace custom implementation of
Math.countlzwith the new enginebit32.countlzfunction - Fix
indexOfto be accessible fromString - Refactor structure to a rotriever workspace
- Fix Error stacktrace to include error name and message
- add
indexOfmethod toStringtype
- add
includesmethod toStringtype
- restructured some internals to avoid circular dependency issues
- fix
WeakMaptyping - distinguish private and public API
- add
getStatusandawaitStatusmethods toPromisetype
- 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.findIndexwill now typecheck the predicate function to ensure types match the suppliedArray<T>Array.reducewill now typecheck the predicate function and initial values to ensure types match the suppliedArray<>Array.fromwill 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.includesandArray.indexOfwill now typecheck the searched element is the same type as the supplied containingArray<>Array.reverse,Array.splice,Array.sort,Array.shift,Array.unshiftwill no longer erase the element type of the suppliedArray<>AssertionError.newno longer requires theoperationfield, and theAssertionErrorinstance field is now nil-able, matching upstream nodejs.Object.entriesandObject.valuesnow returns a more specifically-typedArray<>based on the supplied ObjectObject.freezeandObject.sealshould now retain more type fidelity of the input parameter to the return valueMap,WeakMap, andSetexported tables are now strongly-typed, which mostly aids typechecking of the backing implementation detail.WeakMap.newis now generic, so the return value can be force-cast to specific Key and Value types by users.String.splitnow accepts alimitparameter, to limit the number of split strings returned.String.splitwill now escape Lua pattern match characters in thepatternparameter, allowing for splitting on%and.characters.String.splitbehavior now matches JavaScript when passed an empty pattern.clearTimeoutandclearIntervalwill 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__itermetamethod. Please migrate your loops that use these methods to instead used the generalized iteration approach:
for key, value in myMap do
end- add
awaitmethod toPromise - add multi-return support for
Promise.expect
- implement
AssertionError
- implement
setIntervalandclearInterval - implement
encodeURIComponent, integration tested in Apollo GraphQL project
Symbolis now typed to returnanywhen indexed with a string, allowing code usingSymbol.speciesand the like to type check without casts in the library consumer code.
inspectnow accepts an optional options table with a depth option, which defaults to2.Array.concatwill now accept a non-array as the first parameter, matching theArray.prototype.concatbehavior from JavaScript, and relied upon by React 17'suseImperativeHandletests.Array.sortwill now acceptObject.None(our equivalent of JS'undefined) for the comparator and use the default sort.- the default sort in
Array.sortnow 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.newis used without arguments, theTin 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.newis used without arguments, theKandVin 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.concatwas 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.freezenow usestable.freeze- add
isFrozenmethod 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.
setTimeoutnow usestask.delayas the default implementation, increasing timer resolution from 30hz to 60hz.toExponentialnow returns "nan" when given invalid values, more closely matching MDN documentation and in-browser tests.
- add
forEachmethod toSet - add
forEachmethod toMap - add
isFrozenmethod toObject - add
debugmethod toconsole
Array.forEachwill no longer incorrectly call the callback when the array length changes. The callback also is now more correctly typed.- the
Objecttype exported no longer uses nil-able values, which works around some Luau inference issues, and better matches the typical intention of using it. Array.fromwill now respect thethisArgargument when it is supplied.Array.sliceandArray.filterwill no longer erase the type of theArray<>being operated on.Object.assignwill 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
hasmethod toWeakMap - add
expectmethod toPromise - add
selfparam toPromise's methods
- Fix for
Array.sortto 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
convertcommand Array.joinwill now calltostring()on items before adding them
String.charCodeAt,String.findOrArray.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.fromto supportMapobjects
Promisetype-only, translates relevant portion of Promise type from TypeScript and flowtype, and maps cleanly on top of community Promise libraries.Array.reverse,Array.forEachString.lastIndexOf,String.substrObjecttypeErrortype
- Fix for
instanceofwith objects that have a throwing__indexmetamethod (#86) - Move spec file under
__tests__to fix static analysis error (#85)
-
Object.keysshould return an empty array for sets (#71) -
Make third argument of
Array.map(array, callback, this)optional (#77) -
Settype - add self as first param to Set methods (#76) -
Override
__tostringonSetso 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.splitString.slice
util.inspectwill now emit function names, and use the __tostring metamethod, when printing values, if either are availableSet.newcan 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.startsWithString.endsWithutil.inspectfrom nodejs/luvit.io
- All
consolemethods will now accept non-strings and print them usingutil.inspect - Fix Array.reduce to use 1-based indexing (instead of starting from 0)
Errorobject initializes with an empty string by default
- Remove
--!nonstrictshebangs
- Add stacktrace to
Errorobject - Fix infinite loop case for
instanceOf - Fix
Settyping error for newestroblox-cli
extendsinstanceofArray.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
__tostringmetamethod 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_INTEGERNumber.MIN_SAFE_INTEGERNumber.toExponential()Object.assign()Object.entries()Object.freeze()Object.is()Object.keys()Object.preventExtensions()Object.seal()Object.values()Object.NoneRegExp()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()