-
Notifications
You must be signed in to change notification settings - Fork 0
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
Set up multiple typescript projects #9
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No comments from my side as I don't know TypeScript. Sail away ⛵
Hasn't been modified yet.
Composite projects must emit, but we're only emitting declarations.
... since all projects require it.
Currently includes everything, as per current tsconfig.json. Also includes the DOM and DOM.Iterable libs.
Hasn't been modified yet.
Like other projects do.
Requires passing the --build flag to tsc.
Note that it references tsconfig.app.json, but doesn't get the DOM libs, only the WebWorker lib.
0aebf99
to
ea0c336
Compare
I rebased this on top of |
@psrpinto You shouldn't need to rebase your "sync in worker" PRs on |
Indeed there was no need to do so, and I won't do it with future PRs. It's just that this branch was created before the |
This PR was reverted (by force-push) on |
(Not opened yet upstream as it depends on element-hq#1056 so must wait for that one to be merged first)
Requires #11
In the current typescript setup, attempting to use the
WebWorker
typescript library will not work, as that library is not part of typescript's default libraries. Attempting to require the library through triple-slash directives will result in an error:Definitions of the following identifiers conflict with those in another file: ImportExportKind, TableKind, ValueType ...
This happens because the
WebWorker
andDOM
(which is part of the default libraries) libs define some of the same types. I consulted with a colleague who has experience with Web Workers in typescript and they recommended using typescript's project references feature to address this issue.This PR "splits" the codebase into three typescript projects, which share common configuration, but can also have their own configuration to, e.g. import libraries. These projects are:
app
: Contains all code except workers. Requires theDOM
andDOM.iterable
libsworkers
: Contains workers only. Requires theWebWorkers
lib. References theapp
project.sdk
: Contains all code except workers. Requires theDOM
andDOM.iterable
libs. Only emits declarations.The top-level
tsconfig.json
only contains references to each project.Caveats
tsc
CLI command requires the--build
flag. Not passing the--build
flag will result in success, but no code has been checked/compiled..typescript
directory.