>(ctor: T): T;
export {
Component,
createContext,
createElement,
createFragment,
createRef,
forwardRef,
None,
oneChild,
Change,
Children,
Event,
Ref,
PureComponent,
};
}
// Props
declare namespace Roact {
export type PropsWithChildren = P & { [Roact.Children]?: Roact.Children };
}
// Component
declare namespace Roact {
export type HostComponent = keyof CreatableInstances;
export type FunctionComponent
= (props: Roact.PropsWithChildren
) => Roact.Element;
export type AnyComponent = Roact.Component | Roact.FunctionComponent | Roact.HostComponent;
export interface ComponentConstructor
{
new (props: P): Roact.Component
;
}
}
// Element
declare namespace Roact {
export interface Element {
component: defined;
props: defined;
source?: string;
}
}
// Fragment
declare namespace Roact {
export type Fragment = Roact.Element;
export const Fragment: Roact.ComponentConstructor<{}, {}>;
}
// Portal
declare namespace Roact {
/**
* A component that represents a portal to a Roblox Instance. Portals are created using Roact.createElement.
*
* Any children of a portal are put inside the Roblox Instance specified by the required target prop. That Roblox Instance should not be one created by Roact.
*
* Portals are useful for creating dialogs managed by deeply-nested UI components, and enable Roact to represent and manage multiple disjoint trees at once.
*
* See the Portals guide for a small tutorial and more details about portals.
*/
export const Portal: Roact.ComponentConstructor<{ target: Instance }>;
export type Portal = typeof Portal;
}
// Binding
declare namespace Roact {
export interface Binding {
/**
* Returns the internal value of the binding. This is helpful when updating a binding relative to its current value.
*/
getValue(): T;
/**
* Returns a new binding that maps the existing binding's value to something else. For example, `map` can be used to
* transform an animation progress value like `0.4` into a property that can be consumed by a Roblox Instance like
* `UDim2.new(0.4, 0, 1, 0)`.
*/
map(predicate: (value: T) => U): Roact.Binding;
}
/**
* The first value returned is a `Binding` object, which will typically be passed as a prop to a Roact host
* component. The second is a function that can be called with a new value to update the binding.
*/
export function createBinding(initialValue: T): LuaTuple<[Roact.Binding, (newValue: T) => void]>;
/**
* Combines multiple bindings into a single binding. The new binding's value will have the same keys as the input
* table of bindings.
*/
export function joinBindings }, U>(
bindings: T,
): Roact.Binding<{ [K in keyof T]: T[K] extends Roact.Binding ? V : never }>;
export function joinBindings(bindings: ReadonlyArray>): Roact.Binding>;
export function joinBindings(
bindings: ReadonlyMap>,
): Roact.Binding