Hi
is there some way I can use TypeScript instead of Javascript for building moodle plugins?
I just like the syntax of TypeScript better.
I have moodle 3.5.1 installed, will be moving to moodle 3.9 soon
In reply to Ava Taylor
Re: TypeScript instead of Javascript for building moodle plugins?
by Marcus Green -
It's not the same, but you can use ES6 in recent versions of Moodle.
https://docs.moodle.org/dev/Javascript_Modules#ES6_Modules_.28Moodle_v3.8_and_above.29
https://docs.moodle.org/dev/Javascript_Modules#ES6_Modules_.28Moodle_v3.8_and_above.29
In reply to Ava Taylor
Re: TypeScript instead of Javascript for building moodle plugins?
by Mark Sharp -
Moodle doesn't automatically handle TypeScript. It does have a gruntjs task-runner for generating js from various other js versions to target the browsers Moodle supports. See Gruntfile.js - https://github.com/moodle/moodle/blob/master/Gruntfile.js
You don't have to use Moodle's task-runner though, you could always create your own, e.g. gulp: https://www.typescriptlang.org/docs/handbook/gulp.html
You don't have to use Moodle's task-runner though, you could always create your own, e.g. gulp: https://www.typescriptlang.org/docs/handbook/gulp.html