Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Support extra props
Make it so that other props can be added to current primitives, to support prop forwarding. Also automatically support prop forwarding from Keyframes to inbuilt primitives
  • Loading branch information
PrecociouslyDigital authored Jul 24, 2018
commit 793080017e1c5408f98f198a16c3551075b6c2ad
28 changes: 14 additions & 14 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const config: {
}

export class Spring<S extends object, DS extends object> extends PureComponent<
SpringProps<S, DS>
SpringProps<S, DS> & S
> {}

export function interpolate(
Expand All @@ -117,10 +117,10 @@ export const animated: {
[Tag in keyof JSX.IntrinsicElements]: ComponentClass<
JSX.IntrinsicElements[Tag]
>
}
};

type TransitionKeyProps = string | number
type TransitionItemProps = string | number | object
type TransitionKeyProps = string | number;
type TransitionItemProps = string | number | object;
Copy link

@lasseborly lasseborly Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally added lonely semi-colons @PrecociouslyDigital ? 😊

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops; My linter is having a fit with the code styles and might have accidentally added them. Personally I think the standard should be semi-colons, but I thought it was better to be consistent

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree @PrecociouslyDigital. Cool!


interface TransitionProps<S extends object, DS extends object = {}> {
/**
Expand Down Expand Up @@ -174,7 +174,7 @@ interface TransitionProps<S extends object, DS extends object = {}> {
export class Transition<
S extends object,
DS extends object
> extends PureComponent<TransitionProps<S, DS>> {}
> extends PureComponent<TransitionProps<S, DS> & S> {}

type TrailKeyProps = string | number
type TrailKeyItemProps = string | number | object
Expand All @@ -199,7 +199,7 @@ interface TrailProps<S extends object, DS extends object = {}> {
}

export class Trail<S extends object, DS extends object> extends PureComponent<
TrailProps<S, DS>
TrailProps<S, DS> & S
> {}

interface ParallaxProps<S extends object, DS extends object = {}> {
Expand All @@ -215,7 +215,7 @@ interface ParallaxProps<S extends object, DS extends object = {}> {
export class Parallax<
S extends object,
DS extends object
> extends PureComponent<ParallaxProps<S, DS>> {}
> extends PureComponent<ParallaxProps<S, DS> & S> {}

interface ParallaxLayerProps<S extends object, DS extends object = {}> {
factor?: number
Expand All @@ -228,25 +228,25 @@ interface ParallaxLayerProps<S extends object, DS extends object = {}> {
export class ParallaxLayer<
S extends object,
DS extends object
> extends PureComponent<ParallaxLayerProps<S, DS>> {}
> extends PureComponent<ParallaxLayerProps<S, DS> & S> {}

interface KeyframesProps<S extends object, DS extends object = {}> {
state?: string
state: string
}

export class Keyframes<S extends object, DS extends object> extends Component<
KeyframesProps<S, DS>
export class Keyframes<S extends object, DS extends object> extends PureComponent<
KeyframesProps<S, DS> & S
> {
static create<S extends object, DS extends object>(
primitive: ComponentType
): (states: object) => (props: object) => Keyframes<S, DS>
static Spring<S extends object, DS extends object>(
states: object
): (props: object) => Keyframes<S, DS>
): (props: object) => Keyframes<S, DS> | Spring<S,DS>
static Trail<S extends object, DS extends object>(
states: object
): (props: object) => Keyframes<S, DS>
): (props: object) => Keyframes<S, DS> | Trail<S,DS>
static Transition<S extends object, DS extends object>(
states: object
): (props: object) => Keyframes<S, DS>
): (props: object) => Keyframes<S, DS> | Transition<S,DS>
}