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

Use a subset of strict: true in the SDK #2010

Open
sodic opened this issue May 6, 2024 · 0 comments · May be fixed by #2054
Open

Use a subset of strict: true in the SDK #2010

sodic opened this issue May 6, 2024 · 0 comments · May be fixed by #2054
Assignees
Labels
dx enhancement New feature or request

Comments

@sodic
Copy link
Contributor

sodic commented May 6, 2024

Building the SDK generates two kinds of files:

  • JavaScript files (.js) used in the runtime.
  • Declaration files (.d.ts) used for type support by the IDE.

Declaration files (d.ts) are subject to our user's tsconfig.json which is more strict than sdk/wasp/tsconfig.json used to build the SDK. This results in the SDK's declaration files having type errors when looked at from the user's perspective (e.g., during go-to-definition jumps).

We've avoided using strict: true in the tsconfig.json we use for building the SDK due to legacy reasons (old JS or improperly typed code that still works).

This is not a big problem, but definitely isn't ideal:

  • Our SDK is deemed "wrong" by our own system, which is a little unprofessional.
  • These type errors truly are type errors (they're not false-positives). Not compiling the SDK in strict mode prevents us from catching them. In other words, a small part of legacy code disqualifies the entire SDK from reaping the full benefits of TypeScript.

Since the strict: true compiler flag is a shorthand for multiple more specific flags, we should activate all the "subflags" that don't require a major refactor of the SDK. After that's done, we can tackle #1938 and change whatever we need to go full strict mode (this will probably take some time).

@sodic sodic changed the title Prevent type errors in generated declaration files Use a subset of strict: true in the SDK May 6, 2024
@sodic sodic added enhancement New feature or request dx labels May 6, 2024
@Martinsos Martinsos assigned Martinsos and sodic and unassigned Martinsos May 16, 2024
@sodic sodic linked a pull request May 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dx enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants