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

Type Errors when copying the example #53

Open
MarceloPeresToi opened this issue Dec 13, 2022 · 7 comments
Open

Type Errors when copying the example #53

MarceloPeresToi opened this issue Dec 13, 2022 · 7 comments
Labels
kind/bug Something is broken or regressed priority/2 medium This needs to be done

Comments

@MarceloPeresToi
Copy link

MarceloPeresToi commented Dec 13, 2022

I've copied & pasted the example from the example folder but got some type errors from typescript from both the WriteRelationshipsRequest and checkPermissionRequest

However, if I add "as any" to the parameters just to get it to compile, the functions work as expected, so it appears to be just something wrong with the type defs.

@MarceloPeresToi
Copy link
Author

The CheckPermissionRequest error
Captura de Tela 2022-12-13 às 18 21 06

And the WriteRelationshipsRequest
Captura de Tela 2022-12-13 às 18 21 58

@josephschorr josephschorr added kind/bug Something is broken or regressed priority/2 medium This needs to be done labels Dec 13, 2022
@samkim
Copy link
Member

samkim commented Dec 28, 2022

@MarceloPeresToi can you provide the version of typescript you're using? I haven't been able to repro the errors using the latest released version (4.9.4)

@MarceloPeresToi
Copy link
Author

Of course! My bad!
I'm using 4.5.2

@samkim
Copy link
Member

samkim commented Dec 28, 2022

Thanks! I tested again with 4.5.2 and still can't repro.

What's odd is that the error for the CheckPermissionRequest line in the original report shows Type: '{ oneofKind: undefined; }' is not assignable... but the line itself has oneofKind: 'fullyConsistent',.

To rule out IDE setup, can you try running tsc from the command line and see if you get the same errors?

@MarceloPeresToi
Copy link
Author

MarceloPeresToi commented Dec 28, 2022

Just checked again and I'm using version 4.5.5. Running tsc got me the same errors.
I'm using v0.10.0 of authzed-node

@MarceloPeresToi
Copy link
Author

MarceloPeresToi commented Dec 28, 2022

It's weird because I'm explicitly passing 'fullyConsistent' as value and for some reason it is treated as undefined...

consistency: v1.Consistency.create({
   requirement: {
     oneofKind: 'fullyConsistent',
     fullyConsistent: true,
   },
}),
Type '{ oneofKind: undefined; }' is not assignable to type '{ oneofKind: "minimizeLatency"; minimizeLatency: boolean; } | { oneofKind: "atLeastAsFresh"; atLeastAsFresh: ZedToken; } | { oneofKind: "atExactSnapshot"; atExactSnapshot: ZedToken; } | { ...; }'.

Property 'fullyConsistent' is missing in type '{ oneofKind: undefined; }' but required in type '{ oneofKind: "fullyConsistent"; fullyConsistent: boolean; }'.```

@samkim
Copy link
Member

samkim commented Dec 29, 2022

I've tried with typescript 4.5.5 and am also using authzed-node v0.10.0 but still no repro. I'm not seeing anything obvious to try next. Perhaps try deleting your node_modules directory and re-installing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something is broken or regressed priority/2 medium This needs to be done
Projects
None yet
Development

No branches or pull requests

3 participants