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

Resolver still type checks even when both globalLayer and local layer are not provided #7

Closed
vecerek opened this issue Jul 25, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@vecerek
Copy link
Contributor

vecerek commented Jul 25, 2023

See the following PR demonstrating the issue: #6.

I would expect a compilation error in such a case instead of a runtime error. The runtime error can be difficult to debug, especially in the case of massive layers.

@iamchanii
Copy link
Owner

I just checked out your demo lightly. it is not a bug and it just a part of not implemented of this library. IMO.

export type PluginOptions<Types extends SchemaTypes> = EmptyToOptional<{
defaultFailErrorConstructor?: { new(message: string): unknown };
globalContext?: ((conext: Types['Context']) => Types['EffectGlobalContext']) | Types['EffectGlobalContext'];
globalLayer?: ((conext: Types['Context']) => Types['EffectGlobalLayer']) | Types['EffectGlobalLayer'];
}>;

I think it is caused by above types. is globalLayer able to require type based on Types['EffectGlobalContext']?

@iamchanii iamchanii added the good first issue Good for newcomers label Jul 26, 2023
@vecerek
Copy link
Contributor Author

vecerek commented Aug 1, 2023

it is not a bug and it just a part of not implemented of this library

@iamchanii bug or not, I wish it didn't type check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants