Open aurium opened 4 years ago
Yeah as I’ve been using scrap more I’ve been wanting TS integration as well.
I really wanted to avoid reusing/abusing class and decorators because the syntax gets hairy very quickly. Better to have a targeted DSL imo.
It might be possible to add a feature where scrap generates a typescript declaration file.
I agree against abusing decorators. :-)
A typescript declaration file looks valid approach. However that means one more build step. It will get harder to use with a watcher builder.
Another issue:
A ts declaration must consider some details from ts code where the scrap is defined, like the var name, namespace and module. May be simpler to make a new file format .scrap
and the compiler to export JS or TS. (I'm not ask to replace the current feature with tagged literals, just to add a transpiler option)
Wonderful! 😍❤️💕
It is not possible to see this and not think about typescript. How to share this type definition with a ts code without repeating that?
Is this possible to have the same feature with decorators and class definitions instead tagged literals? I think it can get highlighting benefits and somehow share typing definition.
could be
I can't see now how to not repeat union types or non base types, however it is editor friendly and will allow highlighting and autocomplete.
This second example (if i'm right) can use type inference and we don't need to repeat:
could be
...OR...
Do scrap really need to know the data type while using typescript? If it don't, so the double typing problem is gone. A base
Scrap
class to be extended must be enough.