Skip to content

Commit

Permalink
fix(core): 🚨 fix TS errors, improve TS defs
Browse files Browse the repository at this point in the history
  • Loading branch information
thierrymichel committed Nov 25, 2019
1 parent fea3c42 commit a48acd2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
16 changes: 8 additions & 8 deletions packages/core/src/defs/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export type HookFunction = (
) => Promise<void> | void;

export class HookMethods {
public before?: (fn: HookFunction, ctx?: any) => void;
public beforeLeave?: (fn: HookFunction, ctx?: any) => void;
public leave?: (fn: HookFunction, ctx?: any) => void;
public afterLeave?: (fn: HookFunction, ctx?: any) => void;
public beforeEnter?: (fn: HookFunction, ctx?: any) => void;
public enter?: (fn: HookFunction, ctx?: any) => void;
public afterEnter?: (fn: HookFunction, ctx?: any) => void;
public after?: (fn: HookFunction, ctx?: any) => void;
public before: (fn: HookFunction, ctx?: any) => void;
public beforeLeave: (fn: HookFunction, ctx?: any) => void;
public leave: (fn: HookFunction, ctx?: any) => void;
public afterLeave: (fn: HookFunction, ctx?: any) => void;
public beforeEnter: (fn: HookFunction, ctx?: any) => void;
public enter: (fn: HookFunction, ctx?: any) => void;
public afterEnter: (fn: HookFunction, ctx?: any) => void;
public after: (fn: HookFunction, ctx?: any) => void;
}
11 changes: 7 additions & 4 deletions packages/core/src/defs/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
* @module typings/core
*/

import { IRouteResolved } from '@barba/router/src/defs/router';
interface IRouteResolved {
name: string;
params: any;
}
import { IUrlFull } from '.';

export type SchemaAttributeValues =
Expand Down Expand Up @@ -46,9 +49,9 @@ export interface ISchemaAttribute {
*/

export interface ISchemaPage {
container: HTMLElement | undefined;
html: string | undefined;
namespace: string | undefined;
container: HTMLElement;
html: string;
namespace: string;
url: IUrlFull;
route?: IRouteResolved | null;
}
14 changes: 7 additions & 7 deletions packages/core/src/schemas/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { ISchemaPage } from '../defs';
* See [[ISchemaPage]]
*/
export const schemaPage: ISchemaPage = {
container: undefined,
html: undefined,
namespace: undefined,
container: null,
html: '',
namespace: '',
url: {
hash: undefined,
href: undefined,
path: undefined,
port: undefined,
hash: '',
href: '',
path: '',
port: null,
query: {},
},
};

0 comments on commit a48acd2

Please sign in to comment.