Hey Enonic-friends!
I got so enthusiastic by doing the webinar about TypeScript in Enonic XP on Tuesday, that set out to fix the largest remaining problem.
And I did it! After more then a year of trying ā I finally did it! I added support for automatically getting types when using the
import
keyword!
Here is a demo of code completion using JavaScript (it would be almost the same in TypeScript).
To enable this support you have to have the enonic-types library installed, and you need to add the following to your tsconfig.json or tsconfig.server.json file.
{
"compilerOptions": {
...
"types": [
"node",
"enonic-types"
]
}
}
My original plan had been to release the 1.0.0 version of enonic-types when I got import
to work.
But if there is a chance that enonic-types can become part of core XP. Iām going to save 1.0.0 a little bit longer.
Btw, now is the perfect time to start using TypeScript in your XP-project! It is awesome!