Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Поясните, плз, за TypeScript + gulp.
- //TypeScript: пример с https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html
- function greeter(person: string) {
- return "Hello, " + person;
- }
- var user = "Jane User";
- document.body.innerHTML = greeter(user);
- //Gulp: пример с https://www.npmjs.com/package/gulp-typescript
- gulp.task('allTS', function () {
- return gulp.src('./s/js/*.ts')
- .pipe(ts({
- noImplicitAny: true,
- outFile: 'ts_output.js'
- }))
- .pipe(gulp.dest("./s/js"));
- });
- //Результат в ts_output.js:
- function greeter(person) {
- return "Hello, " + person;
- }
- var user = "Jane User";
- document.body.innerHTML = greeter(user);
- // ОК, он скомпилировался в обычный JS, а куда делась проверка типа переменной? Что должно быть в галпе, чтобы от ТС был толк?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement