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

Compilation step does not throw error when it should (TS2380) #37

Open
2 tasks
angelaraya opened this issue Aug 13, 2022 · 1 comment
Open
2 tasks

Compilation step does not throw error when it should (TS2380) #37

angelaraya opened this issue Aug 13, 2022 · 1 comment
Labels
bug Something isn't working conventions General conventions to assist development

Comments

@angelaraya
Copy link
Contributor

Some getter/setters in the project should generate errors with TS2380 and stop compilation. The errors correctly surface when using sai-js as a dependency:

../sai-js/packages/data-model/dist/cjs/crud/resource.d.ts:18:9 - error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
  Type 'undefined' is not assignable to type 'string'.

18     get registeredWith(): string | undefined;
           ~~~~~~~~~~~~~~

We should

  • Identify why our build process (lerna run build) is not raising this errors
  • Fix all the instances where the type mismatch happens.
@elf-pavlik elf-pavlik added bug Something isn't working conventions General conventions to assist development labels Jun 7, 2023
@elf-pavlik
Copy link
Collaborator

We are looking into that, so far setting "skipLibCheck": false in the depended helps avoid compilation errors.

There seem to be some valid use cases where the getter can return undefined but the setter should be more strict (e.g. updatedAt is undefined until set on the first update). There are few relevant TS issues:

It looks like only the opposite is allowed where the setter can be loose and it normalizes the value for more strict getter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working conventions General conventions to assist development
Projects
Development

No branches or pull requests

2 participants