I'm using compiler api for many code transformations, using Transformation Api (https://github.com/Microsoft/TypeScript/issues/13762) and Printing api(https://github.com/Microsoft/TypeScript/pull/13761). I can't find many functions of TypeChecker in public. They exist, they do exactly what I need, but I can't use them because they are not public. e.g function isArrayLikeType(type: Type): boolean in checker.ts. Many very useful functions are internal functions of createTypeChecker. And nobody can use them. What should I do to check if a Type is ArrayLike or not?
This question is not only about isArrayLikeType function. There are many useful functions that nobody can use except TypeChecker itself. Same issue in program.ts.
Code is splitted to many small functions and you can't just copy-paste some code, because many of this functions uses other private functions.
Can't agree more on this. As an example I'm in need of https://github.com/Microsoft/TypeScript/blob/37b20ee670e9a89307b0e69960a2cbce104f93e5/src/compiler/utilities.ts#L322
Same pattern in https://github.com/Microsoft/TypeScript/blob/ceae613e4c0ba36829a2381687883ecdc6b169c3/src/services/services.ts#L1056
Why this pattern used? Many enclosured functions and object with this functions in the end. Why do not use usual classes for this purpose?
Why this pattern used? Many enclosured functions and object with this functions in the end. Why do not use usual classes for this purpose?
it is a style the TS team has picked to stay true to JS development experience. classes are becoming more mainstream now, but I do not think we will be breaking the API any time soon.
OP seems to be covered by https://github.com/Microsoft/TypeScript/issues/9879
@deamme node.getText() is not sufficient?
@mhegazy It is! Thank you 馃槃
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Most helpful comment
Can't agree more on this. As an example I'm in need of https://github.com/Microsoft/TypeScript/blob/37b20ee670e9a89307b0e69960a2cbce104f93e5/src/compiler/utilities.ts#L322