Giter VIP home page Giter VIP logo

ts-api-guardian's Introduction

ts-api-guardian's People

Contributors

alan-agius4 avatar alexeagle avatar alxhub avatar chuckjaz avatar gkalpak avatar igorminar avatar naomiblack avatar vsavkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ts-api-guardian's Issues

Missing `?` operator in the output

Expecting:

  'Renderer.invokeElementMethod(renderElement:any, methodName:string, args?:any[]):any',

Was:

  'Renderer.invokeElementMethod(renderElement:any, methodName:string, args:any[]):any',

Note: missing args?

Does not work on Windows due to path delimiter issues

The command gulp public-api:update fails on Windows with the error:

Error: Source file "dist\packages-dist\core\index.d.ts" not found

However the file exists. It is not found because the path string is made of Windows path delimiters \ instead of Unix delimiters /.

As a dirty hack you can change this.fileName = fileName; in the ResolvedDeclarationEmitter constructor to this.fileName = fileName.replace(/\\/g,"/");.
With this change the update command runs successfully.
However a more appropriate fix might be necessary.

Overloading a function doesn't generate all of the signatures

When I try to overload a function it doesn't add the overloaded signature to the api file like it does for class methods.

Code of the function:

export function registerLocaleData(data: any, extraData?: any): void;
export function registerLocaleData(data: any, localeId?: string, extraData?: any): void;
export function registerLocaleData(data: any, localeId?: string | any, extraData?: any): void {
  ...
}

Declarations generated by typescript:

export declare function registerLocaleData(data: any, extraData?: any): void;
export declare function registerLocaleData(data: any, localeId?: string, extraData?: any): void;

Api file:

export declare function registerLocaleData(data: any, extraData?: any): void;

Throws and error if symbol is exported as a name that matches the `stripExportPattern`.

REPRO:

  1. Create a API that exports original_symbol as _private_symbol.
  2. Run ts-api-guardian on the with stripExportPattern to include any symbol that begins with _ (e.g. /^_/)

RECEIVED:
Exception: Symbol "original_symbol" was aliased as "_private_symbol". Aliases are not supported."

EXPECTED:
API golden file produced without error that doesn't include _private_symbol.

New typescript syntax is not supported

I noticed that some typescript features are not supported. Example keyof

An invalid golden files is being generated

Example instead of the below;

/** @stable */
export declare type SimpleChanges<T = any> = {
    [P in keyof T]?: SimpleChange<T[P]>;
};
/** @stable */
export declare const SkipSelf: SkipSelfDecorator;

it is generating the below in public_api_guard/core/core.d.ts

/** @stable */
export declare type SimpleChanges<T = any> = {
    [P in keyof

/** @stable */
export declare const SkipSelf: SkipSelfDecorator;

angular/angular#22103 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.