Skip to content

Conversation

yuan1238y
Copy link

@yuan1238y yuan1238y commented Oct 13, 2025

error1:
When i use this config.
File: collections.Users.index.ts

...
export const Users: CollectionConfig = {
  slug: "users",
  auth: {
    loginWithUsername: {
      allowEmailLogin: true,
    },
  },
...
}

The payload-config.ts is

...
export interface AdminAuthOperations {
  forgotPassword:
    | {
        email: string;
      }
    | {
      username: string;
      };
  login:
    | {
        email: string;
        password: string;
      }
    | {
        password: string;
        username: string;
      }
  registerFirstUser: {
      password: string;
      username: string;
      email?: string;
    };
  unlock:
    | {
        email: string;
      }
    | {
        username: string;
      };
}
...

So new PayloadSDK<Config> got error: not satisfy the constraint

error2:

When i use select condition:

const sdk = new PayloadSDK<Config>({ baseURL: "http://localhost:3000" });
const result = await sdk.find({
  collection: "entries",
  select: {
    path: true,
    updatedAt: true,
  },
});

// this line got error `Property 'path' does not exists`
console.log(result.docs[0].path);

when user collection config `auth.loginWithUsername.allowEmailLogin = true`, use `new PayloadSDK<Config>` got error: `not satisfy the constraint`
use `sdk.find({collection, select: {foo: true}})` the result type cannot find field `foo`.
@yuan1238y yuan1238y changed the title Fix sdk types annotations fix(sdk): fix package sdk types error Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant