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.

Suggestion about `transformers`

See original GitHub issue

Better to support array of transformer creators, not a one factory function.

import * as ts from 'typescript'

interface CustomTransformer {
    before?: ts.TransformerFactory<ts.SourceFile> | void
    after?: ts.TransformerFactory<ts.SourceFile> | void
}

type TransformerFactoryCreator = (ls: ts.LanguageService) => CustomTransformer

function createTransformers(creators: TransformerFactoryCreator[]): (program: ts.LanguageService) => ts.CustomTransformers {
    return (ls: ts.LanguageService) => {
        const result = {
            before: <ts.TransformerFactory<ts.SourceFile>[]>[],
            after: <ts.TransformerFactory<ts.SourceFile>[]>[]
        }
        for(let creator of creators) {
            const factory = creator(ls)
            if (factory.before) result.before.push(factory.before)
            if (factory.after) result.after.push(factory.after)
        }
        return result
    }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zerkalicacommented, May 4, 2018

Ok, last commit works

0reactions
ezolenkocommented, May 22, 2022

In 0.14.0 now

Read more comments on GitHub >

github_iconTop Results From Across the Web

On the Study of Transformers for Query Suggestion
In this article, we study multiple Transformer architectures applied to the query suggestion task and compare them with recurrent neural network (RNN)-based ...
Read more >
A Transformer-based recommendation system - Keras
This example demonstrates the Behavior Sequence Transformer (BST) model, by Qiwei Chen et al., using the Movielens dataset. The BST model ...
Read more >
Original 13 Transformers Suggestions? - The 2005 Boards
I'd suggest Skullcruncher. Alligorcons have always been associated with Quintessons as well so why not have one of them actually be Quintus ...
Read more >
On the Study of Transformers for Query Suggestion
In this paper, we study multiple Transformer architectures applied to the query suggestion task and compare them with RNN-based models.
Read more >
Sequential recommendation: A study on transformers, nearest ...
A number of machine learning models were proposed recently for the task of sequential recommendation, with the latest ones based on deep learning...
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