logto-io / js

šŸ¤“ Logto JS SDKs.
https://docs.logto.io/quick-starts/
MIT License
61 stars 40 forks source link

export types #686

Closed Dakuan closed 5 months ago

Dakuan commented 5 months ago

Hi! šŸ‘‹

Firstly, thanks for your work on this project! šŸ™‚

Today I used patch-package to patch @logto/next@3.2.1 for the project I'm working on.

I order to have better typesafety within my app, id like to reuse logo sdk types

Here is the diff that solved my problem:

diff --git a/node_modules/@logto/next/lib/server-actions/client.d.ts b/node_modules/@logto/next/lib/server-actions/client.d.ts
index bc70f60..d570273 100644
--- a/node_modules/@logto/next/lib/server-actions/client.d.ts
+++ b/node_modules/@logto/next/lib/server-actions/client.d.ts
@@ -1,6 +1,6 @@
 import { type GetContextParameters, type InteractionMode } from '@logto/node';
 import BaseClient from '../src/client';
-import type { LogtoNextConfig } from '../src/types.js';
+export type { LogtoNextConfig } from '../src/types.js';
 export type { LogtoContext, InteractionMode } from '@logto/node';
 export default class LogtoClient extends BaseClient {
     constructor(config: LogtoNextConfig);
diff --git a/node_modules/@logto/next/lib/src/index.d.ts b/node_modules/@logto/next/lib/src/index.d.ts
index 8c02a94..877bee9 100644
--- a/node_modules/@logto/next/lib/src/index.d.ts
+++ b/node_modules/@logto/next/lib/src/index.d.ts
@@ -4,7 +4,7 @@ import NodeClient, { type GetContextParameters, type InteractionMode } from '@lo
 import { type GetServerSidePropsResult, type GetServerSidePropsContext, type NextApiHandler, type NextApiRequest, type NextApiResponse } from 'next';
 import { type NextApiRequestCookies } from 'next/dist/server/api-utils/index.js';
 import LogtoNextBaseClient from './client.js';
-import type { LogtoNextConfig } from './types.js';
+export type { LogtoNextConfig } from './types.js';
 export { LogtoError, LogtoRequestError, LogtoClientError, OidcError, Prompt, ReservedScope, ReservedResource, UserScope, organizationUrnPrefix, buildOrganizationUrn, getOrganizationIdFromUrn, PersistKey, } from '@logto/node';
 export type { AccessTokenClaims, IdTokenClaims, LogtoContext, InteractionMode, LogtoErrorCode, } from '@logto/node';
 export default class LogtoClient extends LogtoNextBaseClient {

This issue body was partially generated by patch-package.