Open wodka opened 3 weeks ago
@peintnermax can you please have a look at this
@wodka can you describe a little better what you try to achieve? How are you importing the types right now?
@peintnermax I would like to consume the generated types from the package as part of my implementation.
// this is the path where the file resides, but cannot import it
// import { Profile } from '@zitadel/node/dist/commonjs/api/generated/zitadel/user'
// this would be a nice import path that decides itself between commonjs and esm
// import { Profile } from '@zitadel/node/api/generated/zitadel/user'
function somewhere() {
const response = await this.zitadel.getForOrg(user.zitadelResourceOwner).getHumanProfile({ userId: user.zitadel });
return new UserDto(user, response.profile!);
}
class UserDto {
constructor(user: UserEntity, p: Profile) {
// beeing able to use the typed data in here!
}
}
currently I am adding a copy of the zitadel profile type in my own code base, but it would be great to be able to use it from the package
@peintnermax I would like to consume the generated types from the package as part of my implementation.
// this is the path where the file resides, but cannot import it // import { Profile } from '@zitadel/node/dist/commonjs/api/generated/zitadel/user'
// this would be a nice import path that decides itself between commonjs and esm // import { Profile } from '@zitadel/node/api/generated/zitadel/user'
function somewhere() { const response = await this.zitadel.getForOrg(user.zitadelResourceOwner).getHumanProfile({ userId: user.zitadel });
return new UserDto(user, response.profile!); }
class UserDto { constructor(user: UserEntity, p: Profile) { // beeing able to use the typed data in here! } } currently I am adding a copy of the zitadel profile type in my own code base, but it would be great to be able to use it from the package
Got it.. Types are exported by the package @zitadel/proto
. Can you try if this fixes your issue?
import { User, UserState } from "@zitadel/proto/zitadel/user/v2/user_pb";
Preflight Checklist
Describe your problem
I would like to type function that use part of the api response. when ie importing Profile the compile will crash:
Describe your ideal solution
export the generated types
Version
No response
Environment
Self-hosted
Additional Context
No response