mirror of
https://github.com/zhigang1992/nativewind.git
synced 2026-06-15 02:09:06 +08:00
fix: typescript types after upgrade
This commit is contained in:
@@ -47,7 +47,8 @@ export type Snapshot = Record<string, StylesArray>;
|
||||
|
||||
const emptyStyles: StylesArray = Object.assign([], { mask: 0 });
|
||||
|
||||
export interface StylesArray<T = Style> extends Array<EitherStyle<T>> {
|
||||
export interface StylesArray<T extends Style = Style>
|
||||
extends Array<EitherStyle<T>> {
|
||||
childClassNames?: string[];
|
||||
mask?: number;
|
||||
}
|
||||
@@ -467,7 +468,10 @@ export class StyleSheetRuntime extends ColorSchemeStore {
|
||||
return reEvaluate();
|
||||
}
|
||||
|
||||
getChildStyles<T>(parent: StylesArray<T>, options: MatchChildAtRuleOptions) {
|
||||
getChildStyles<T extends Style>(
|
||||
parent: StylesArray<T>,
|
||||
options: MatchChildAtRuleOptions
|
||||
) {
|
||||
if (!parent.childClassNames) return;
|
||||
|
||||
const styles: Style[] = [];
|
||||
|
||||
@@ -88,7 +88,7 @@ export function styled<T, P extends keyof T, C extends keyof T>(
|
||||
* Actual implementation
|
||||
*/
|
||||
export function styled<
|
||||
T extends { style?: StyleProp<unknown>; children?: ReactNode | undefined },
|
||||
T extends { style?: StyleProp<any>; children?: ReactNode | undefined },
|
||||
P extends keyof T,
|
||||
C extends keyof T
|
||||
>(
|
||||
|
||||
@@ -2,16 +2,17 @@ import { useContext, useMemo } from "react";
|
||||
import { StyleProp, StyleSheet } from "react-native";
|
||||
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
||||
import { Snapshot, StoreContext, StylesArray } from "../style-sheet";
|
||||
import { Style } from "../style-sheet/runtime";
|
||||
import { StateBitOptions } from "../utils/selector";
|
||||
|
||||
export interface UseTailwindOptions<T> extends StateBitOptions {
|
||||
export interface UseTailwindOptions<T extends Style> extends StateBitOptions {
|
||||
className: string;
|
||||
inlineStyles?: StyleProp<T>;
|
||||
additionalStyles?: StylesArray<T>;
|
||||
flatten?: boolean;
|
||||
}
|
||||
|
||||
export function useTailwind<T>({
|
||||
export function useTailwind<T extends Style>({
|
||||
className,
|
||||
inlineStyles,
|
||||
additionalStyles,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ComponentState } from "./use-component-state";
|
||||
export interface WithStyledChildrenOptions {
|
||||
componentChildren: ReactNode;
|
||||
store: StyleSheetRuntime;
|
||||
stylesArray: StylesArray<unknown>;
|
||||
stylesArray: StylesArray<any>;
|
||||
mask: number;
|
||||
componentState: ComponentState;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user