diff --git a/CHANGELOG.md b/CHANGELOG.md index 81f6b9ff..0ae4af92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ * Removed the warning for `setState` on unmounted components to eliminate false positive warnings, matching upstream React ([#323](https://github.com/Roblox/roact/pull/323)). * Added Luau analysis to the repository ([#372](https://github.com/Roblox/roact/pull/372)) +## [1.4.3](https://github.com/Roblox/roact/releases/tag/v1.4.1) (March 18th, 2022) +* Added types to Roact to better support intellisense. + ## [1.4.2](https://github.com/Roblox/roact/releases/tag/v1.4.2) (October 6th, 2021) * Fixed forwardRef doc code referencing React instead of Roact ([#310](https://github.com/Roblox/roact/pull/310)). * Fixed `Listeners can only be disconnected once` from context consumers. ([#320](https://github.com/Roblox/roact/pull/320)) diff --git a/src/init.lua b/src/init.lua index f58d32a5..73c1cdd1 100644 --- a/src/init.lua +++ b/src/init.lua @@ -10,10 +10,21 @@ local RobloxRenderer = require(script.RobloxRenderer) local strict = require(script.strict) local Binding = require(script.Binding) +export type ConfigTable = { + elementTracing: boolean?, + internalTypeChecks: boolean?, + propValidation: boolean?, + typeChecks: boolean?, +} + +export type SetGlobalConfig = (config: ConfigTable) -> () + local robloxReconciler = createReconciler(RobloxRenderer) local reconcilerCompat = createReconcilerCompat(robloxReconciler) -local Roact = strict({ +local setGlobalConfig = GlobalConfig.set :: SetGlobalConfig + +local Roact = { Component = require(script.Component), createElement = require(script.createElement), createFragment = require(script.createFragment), @@ -40,10 +51,11 @@ local Roact = strict({ teardown = reconcilerCompat.teardown, reconcile = reconcilerCompat.reconcile, - setGlobalConfig = GlobalConfig.set, + setGlobalConfig = setGlobalConfig, -- APIs that may change in the future without warning UNSTABLE = {}, -}) +} -return Roact +export type Roact = typeof(Roact) +return strict(Roact, "Roact") :: Roact