question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript Task decorators

See original GitHub issue

Suggesting Typescript decorators for supplying the task description and name properties since there is no easy way in typescript to extend function at least not as easy as JS

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Kaffiendcommented, Jan 10, 2018

I see how that could cause more work than necessary. I’m inclined to agree on that front. But i also see potential for additional organization and structure to a build pipeline. What i had in mind was something like this.

class Tasks {

@description('clean stuffs')
@task('clean')
static clean(cb) {
//del stuff.
cb();
}

@description('build the styles')
@task('buildStyles')
static buildStyles(cb) {
//do more stuff.
cb();
}

@description('build stuffs')
@task('build:app')
@series('clean', 'buildStyles')
static buildApp(cb) {
// do app building stuffs.
cb();
}

@description('awesome default task')
@flags({'--dev': 'test'})
@task('default')
static default(cb) {

cb();
}

or maybe even overriding the constructor with a decorator for declaring series and parallel task execution

on another note to access those properties with typescript casting the functions at TaskFunction and exporting its constant works fine, the gulp-cli picks it all up nicely!!

0reactions
phatedcommented, Feb 23, 2019

@StevenLiekens fair enough. I don’t do typescript things so thanks for elaborating.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Decorators - TypeScript
A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators use...
Read more >
A practical guide to TypeScript decorators - LogRocket Blog
TypeScript decorators enable you to do cools things such as calculate execution time, perform runtime type assertion, guard against errors, ...
Read more >
Decorators · Issue #2249 · microsoft/TypeScript - GitHub
A valid decorator should be: Assignable to one of the Decorator types (ClassDecorator | PropertyDecorator | MethodDecorator | ParameterDecorator) as described ...
Read more >
Building custom typescript decorators for angular
In this article, we will look at typescript decorators, and how they can help us add abstraction and reusability to our code.
Read more >
Deep introduction to using and implementing TypeScript ...
The five types of decorators in TypeScripts · Class Decorators are attached to classes · Property Decorators are attached to property definitions ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found