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
Idiomatic organisation of types #347
Comments
I can take a look at this next Notes (:leaves: evergreen)(adding below as I look into this)
On getting
|
@bodymindarts just to be clear on this, is this issue asking that we stop explicitly importing types and rather have all our own declarations available globally as well? I started looking into this approach and it seems that one problem that would need to be managed is namespace clashes. For e.g. if the type exists globally already and someone re-declares it locally, I believe the existing global type simply gets extended, which can lead to some potential unexpected behaviours. It also looks like this sort of functionality is usually reserved for vendor typings (if I understand correctly) Edit 1: Adding feedback from 22/Jul Dev West call Points made by Samer:
|
Implementation (:leaves: evergreen)I've started playing with an implementation here. Next steps:
|
Some thoughts on this topic. I have to say I actually like explicit imports in general. It makes it easier to see the dependencies of file. That being said I think we certainly should adopt what is generally accepted as an idiomatic style from the ts community. @samerbuna has the most ts experience and is advocating for this approach. Could you perhaps post a link to 1 or 2 projects you consider doing this in an idiomatic way so we have something to refer to in this consideration? I completely agree with the explicit type names argument regardless of scoping. |
I just added some additional notes to the 'Notes ( 🍃 evergreen)' comment above on:
|
Based on chat with @samerbuna, we decided that the approach will be to:
The goal will be to minimize, and if possible eventually remove the global |
Currently we have 1 file:
from which we import the types.
An idiomatic way to do this would be:
Like this typescript should pick up the types automatically without needing to import them.
The text was updated successfully, but these errors were encountered: