Skip to content

Commit

Permalink
fix: typescript typings (#531)
Browse files Browse the repository at this point in the history
#### Summary

Updates some typings that cause build errors on `tsc` in Typescript v3.2.1
#### Description

- new Omit is from microsoft/TypeScript#25041 (comment)
- stops implicity 'any' error on next parameter
- fixes destructuring confusion
  • Loading branch information
ChrisW-B authored and tdeekens committed Dec 3, 2018
1 parent 8a12a07 commit 4bf1e00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/react-redux/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ declare module '@flopflip/react-redux' {
export class ToggleFeature extends React.Component<
ToggleComponentProps,
any
> {}
> { }

export function createFlopFlipEnhancer(adapter: any, adapterArgs?: any): (next) => () => void;
export function createFlopFlipEnhancer(adapter: any, adapterArgs?: any): (next: any) => () => void;
export function flopflipReducer(state: {}, action: {}): any;
export function selectFeatureFlag(flagName: FlagName): (state: {}) => Flags;
export function selectFeatureFlags(state: {}): Flags;
Expand Down
13 changes: 7 additions & 6 deletions packages/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ declare module '@flopflip/types' {

export type Diff<T extends string, U extends string> = ({ [P in T]: P } &
{ [P in U]: never } & { [x: string]: never })[T];
export type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
export type Omit<T, K extends keyof T> = Pick<T,
({ [P in keyof T]-?: P } & { [P in K]: never })[keyof T]>;

export interface ComponentEnhancerWithProps<ProvidedProps, RerquiredProps> {
<P extends ProvidedProps>(
Expand Down Expand Up @@ -39,8 +40,8 @@ declare module '@flopflip/types' {
untoggledComponent?: React.ComponentType<any>;
render?: () => React.ReactNode;
children?:
| (({ isFeatureEnabled: boolean }) => React.ReactNode)
| React.ReactNode;
| (({ isFeatureEnabled }: { isFeatureEnabled: boolean }) => React.ReactNode)
| React.ReactNode;
isFeatureEnabled: boolean;
}
export interface ToggleComponentProps extends ToggleComponentCommonProps {
Expand Down Expand Up @@ -84,15 +85,15 @@ declare module '@flopflip/types' {
export class ToggleFeature extends React.Component<
ToggleComponentProps,
any
> {}
> { }

export class ConfigureFlopFlip extends React.Component<
ConfigureComponentProps,
any
> {}
> { }

export class ReconfigureFlopFlip extends React.Component<
ReconfigureComponentProps,
any
> {}
> { }
}

0 comments on commit 4bf1e00

Please sign in to comment.