From e3edc353a292452cfa932fea7eec763b87675d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Ng=E1=BB=8Dc=20Ph=C6=B0=E1=BB=9Bc?= <36961907+SilentCatD@users.noreply.github.com> Date: Sat, 9 Dec 2023 14:53:53 +0700 Subject: [PATCH] Prerelease (#25) * prerelease * new props for provider * typed override name * add test and docs * merge provider props * pump version * remove redundant params * found out type for abstract constructor * pump version * add isolatedModule --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/hooks/useNamedProvider.ts | 2 +- src/hooks/useProvider.ts | 2 +- src/index.ts | 19 +++++++++++-------- tsconfig.json | 1 + 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17427f9..e25010f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.3.3 + +- enable `isolatedModules` in tsconfig + # 1.3.2 - Found out a way to use abstract constructor type. diff --git a/package.json b/package.json index ae03c17..dfcc339 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-scoped-provider", - "version": "1.3.2", + "version": "1.3.3", "description": "Library for DI in react without the need of self-creating context everytime.", "type": "module", "source": "src/index.ts", diff --git a/src/hooks/useNamedProvider.ts b/src/hooks/useNamedProvider.ts index 44972c2..449d516 100644 --- a/src/hooks/useNamedProvider.ts +++ b/src/hooks/useNamedProvider.ts @@ -33,4 +33,4 @@ function useNamedProvider(name: string, configs?: UseNamedProviderConfig): T } export default useNamedProvider -export { UseNamedProviderConfigDisAllowUndef, UseNamedProviderConfig, UseNamedProviderConfigAllowUndef } +export type { UseNamedProviderConfigDisAllowUndef, UseNamedProviderConfig, UseNamedProviderConfigAllowUndef } diff --git a/src/hooks/useProvider.ts b/src/hooks/useProvider.ts index 7329ac1..4cd6078 100644 --- a/src/hooks/useProvider.ts +++ b/src/hooks/useProvider.ts @@ -35,4 +35,4 @@ function useProvider(ctor: Constructor, configs?: string | UseProviderConf } export default useProvider -export { UseProviderConfigsAllowUndef, UseProviderConfigsDisAllowUndef, UseProviderConfigs } +export type { UseProviderConfigsAllowUndef, UseProviderConfigsDisAllowUndef, UseProviderConfigs } diff --git a/src/index.ts b/src/index.ts index 53757db..d2202e4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,13 +41,15 @@ export type { NamedConsumerDisAllowUndefProps, NamedConsumerAllowUndefProps, } -export { Create, Constructor } -export { ProviderProps, Provider, CreateProviderProps, ValueProviderProps } -export { ProviderScope, ProviderScopeProps } -export { ProviderContext, ContextData } -export { - useProvider, - useNamedProvider, +export type { Create, Constructor } +export { Provider } +export type { ProviderProps, CreateProviderProps, ValueProviderProps } +export { ProviderScope } +export type { ProviderScopeProps } +export { ProviderContext } +export type { ContextData } +export { useProvider, useNamedProvider } +export type { UseNamedProviderConfig, UseNamedProviderConfigAllowUndef, UseNamedProviderConfigDisAllowUndef, @@ -55,6 +57,7 @@ export { UseProviderConfigsDisAllowUndef, UseProviderConfigs, } -export { MultiProvider, ReceivableElement, MultiProviderProps } +export { MultiProvider } +export type { ReceivableElement, MultiProviderProps } export { ResourcesNotProvidedError } export { getObjectRuntimeName, isCreate } diff --git a/tsconfig.json b/tsconfig.json index 7e8e5e0..e02aa08 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,7 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "noUnusedLocals": true, + "isolatedModules": true, "noUnusedParameters": true, "moduleResolution": "node", "jsx": "react-jsx",