Skip to content

Commit

Permalink
feat: Export EntitySchema and EntityInstance types
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Feb 6, 2020
1 parent 6177cfa commit edef484
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/rest-hooks/src/index.ts
Expand Up @@ -48,6 +48,7 @@ export * from './types';
export * from './resource/shapes';
export * from './resource/normal';
export * from './resource/publicTypes';
export * from './resource/Entity';
export {
Resource,
SimpleResource,
Expand Down
2 changes: 1 addition & 1 deletion packages/rest-hooks/src/resource/Entity.ts
Expand Up @@ -163,7 +163,7 @@ if (process.env.NODE_ENV !== 'production') {
};
}

type EntitySchema<E extends typeof Entity> = E & {
export type EntitySchema<E extends typeof Entity> = E & {
normalize(
input: any,
parent: any,
Expand Down
1 change: 1 addition & 0 deletions packages/rest-hooks/src/resource/index.ts
Expand Up @@ -6,5 +6,6 @@ export * from './shapes';
export * from './types';
export * from './publicTypes';
export * from './normal';
export * from './Entity';

export { Resource, SimpleResource, SimpleRecord, Entity };
2 changes: 2 additions & 0 deletions packages/rest-hooks/src/types.ts
Expand Up @@ -26,6 +26,8 @@ export type AbstractInstanceType<T> = T extends { prototype: infer U }
? U
: never;

export type EntityInstance<T> = Readonly<AbstractInstanceType<T>>;

export type PK = string | number;

export type State<T> = Readonly<{
Expand Down

0 comments on commit edef484

Please sign in to comment.