Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix createApp return type #41

Merged
merged 3 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "async-app",
"version": "4.8.0",
"version": "4.8.1",
"description": "An express wrapper for handling async middlewares, order middlewares, schema validator, and other stuff",
"type": "commonjs",
"main": "dist/index.js",
Expand Down
11 changes: 7 additions & 4 deletions src/create-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ const asyncAppProvider: AppProvider = <

let appProvider: AppProvider<any, any> = asyncAppProvider;

export const resetProvider = () => (appProvider = asyncAppProvider);
export const resetProvider = () => {
appProvider = asyncAppProvider;
};

export const setProvider = (provider: AppProvider<any, any>) =>
(appProvider = provider);
export const setProvider = (provider: AppProvider<any, any>) => {
appProvider = provider;
};

export const createApp = <TEntities extends Entities = Entities, TSchema = {}>(
opts?: Opts<TEntities, TSchema>,
) => appProvider(opts);
): App<TEntities, TSchema> => appProvider(opts);

export default createApp;