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

View Collections with ID field only returns never #97

Open
Aragur opened this issue Feb 3, 2024 · 2 comments
Open

View Collections with ID field only returns never #97

Aragur opened this issue Feb 3, 2024 · 2 comments

Comments

@Aragur
Copy link

Aragur commented Feb 3, 2024

Describe the bug
My view collection has only an ID field, as this returns a public count of entries.
This was generated by typegen:

export type MainDataCountResponse<Texpand = unknown> = Required<MainDataCountRecord> & BaseSystemFields<Texpand>;

Accessing the ID field doesn't work with following error:

[{
	"owner": "typescript",
	"code": "2339",
	"severity": 8,
	"message": "Property 'id' does not exist on type 'never'.",
	"source": "ts"
}]

Versions
pocketbase-typegen version: 1.2.1
pocketbase version: 0.21.1

@wojtekgalaj
Copy link

I think in general the id field needs to be added to all the collection types.

@patmood
Copy link
Owner

patmood commented Feb 26, 2024

@Aragur could you provide steps to reproduce this? Eg what is the query for your view collection? Could you also provide the generated type definition for MainDataCountRecord?

id is already part of BaseSystemFields so it should be part of all responses.

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

No branches or pull requests

3 participants