Giter Site home page Giter Site logo

ikatyang / dts-element-fp Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 0.0 304 KB

typescript definition generator for functional programming

Home Page: https://ikatyang.github.io/dts-element-fp/

License: MIT License

TypeScript 100.00%
dts-element functional-programming typescript typescript-definitions

dts-element-fp's People

Contributors

dependabot[bot] avatar ikatyang avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dts-element-fp's Issues

Incorrect output with `inlint_return_type: true`

  • all various
    declare const type: type_null_0;
    // should merge all mergeable types
    type type_null_0 = {
        (value: null): "Null";
    };
    type type_undefined_0 = {
        (value: undefined): "Undefined";
    };
    type type_boolean_0 = {
        (value: boolean): "Boolean";
    };
    type type_number_0 = {
        (value: number): "Number";
    };
    type type_string_0 = {
        (value: string): "String";
    };
    type type_symbol_0 = {
        (value: symbol): "Symbol";
    };
    type type_general_0 = {
        (value: any): string;
    };
    export = type;
  • contains typePredicate
    declare const is: is_00;
    type is_00 = {
        <T>(constructor: Constructor<T>): is_10<T>;
        (_constructor: PH, value: any): is_01;
        <$SEL extends "1">(): <T>(constructor: Constructor<T>) => is_10<T>;
        <$SEL extends "01">(): (_constructor: PH, value: any) => is_01;
        <$SEL extends "11">(): <T>(constructor: Constructor<T>, value: any) => value is T;
        <T>(constructor: Constructor<T>, value: any): value is T;
    };
    type is_10<T> = {
        (value: any): value is T;
    };
    type is_01 = {
        <T>(constructor: Constructor<T>): value is T;
        //                                ^^^^^ [ts] Cannot find parameter 'value'.
    };
    export = is;

Support mixed case

function a(x: number, y: boolean): any;
function b(x: number, y: string): any;
function c(x: object, y: string): any;

Current

type a = {
  (x: number): (y: boolean) => any;
};
type b = {
  (x: number): (y: string) => any;
};
type c = {
  (x: object): (y: string) => any;
};

Proposed

type a_b = {
  (x: number): {
    (y: boolean): any;
    (y: string): any;
  };
};
type c = {
  (x: object): (y: string) => any;
};

Dependency deprecation warning: tslint-config-prettier-ext (npm)

On registry https://registry.npmjs.org/, the "latest" version (v1.5.0) of dependency tslint-config-prettier-ext has the following deprecation notice:

[DEPRECATED] This project has been merged into tslint-config-prettier

Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake.

Affected package file(s): package.json

If you don't care about this, you can close this issue and not be warned about tslint-config-prettier-ext's deprecation again. If you would like to completely disable all future deprecation warnings then add the following to your config:

"suppressNotifications": ["deprecationWarningIssues"]

Remove unnecessary types for non-placeholder version

dts.emit(curried_declarations_various); /*=>
  declare const map: map_00;
  type map_00 = {
      <T, U>(fn: (x: T) => U): map_10<T, U>;
      <T, U>(fn: (x: T) => U, list: List<T>): map_list_11<U>;
      <T, U>(fn: (x: T) => U, functor: Functor<T>): map_functor_11<U>;
  };
  type map_10<T, U> = {
      (list: List<T>): map_list_11<U>;
      (functor: Functor<T>): map_functor_11<U>;
  };

  // ====== unnecessary ======
  type map_list_01<T> = {
      <U>(fn: (x: T) => U): map_list_11<U>;
  };
  type map_functor_01<T> = {
      <U>(fn: (x: T) => U): map_functor_11<U>;
  };
  // ====== unnecessary ======

  type map_list_11<U> = U[];
  type map_functor_11<U> = Functor<U>;
*/

Add an option to inline the final return type

declare const append: append_00;
type append_00 = {
  <T>(value: T): append_10<T>;
-  <T, U>(value: T, list: List<U>): append_11<T, U>;
+  <T, U>(value: T, list: List<U>): (T | U)[];
};
type append_10<T> = {
-  <U>(list: List<U>): append_11<T, U>;
+  <U>(list: List<U>): (T | U)[];
};
-type append_11<T, U> = (T | U)[];

See typed-typings/npm-ramda#191 (comment) for the reason.

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.