Giter VIP home page Giter VIP logo

js2dts's Introduction

whxaxes's GitHub stats

๐Ÿš€๐Ÿš€๐Ÿš€๐Ÿš€๐Ÿš€

js2dts's People

Contributors

jacksontian avatar wangshijun avatar whxaxes avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

js2dts's Issues

missing import of dependencies interfaces

When I generate the dts of this js code

import {createSelector} from 'reselect';

export const sliceSelector = state => state['sliceName'];
export const valueSliceSelector = createSelector(sliceSelector, (slice) => {
    return slice.value;
});

it generates:

// Generate by [js2dts](https://github.com/whxaxes/js2dts#readme)

export function sliceSelector(state: any): any;
export const valueSliceSelector: OutputSelector<any, any, (res: any) => any>;

The OutputSelector interface came from reselect lib

export type OutputSelector<S, R, C> = Selector<S, R> & {
  resultFunc: C;
  recomputations: () => number;
  resetRecomputations: () => number;
}

export function createSelector<S, R1, T>(
  selector: Selector<S, R1>,
  combiner: (res: R1) => T,
): OutputSelector<S, T, (res: R1) => T>;

It is well reinjected in the genrated dst, what is very good,
but its import is missing

The generated result might be

// Generate by [js2dts](https://github.com/whxaxes/js2dts#readme)
import {OutputSelector} from 'reselect';

export function sliceSelector(state: any): any;
export const valueSliceSelector: OutputSelector<any, any, (res: any) => any>;

duplicate class identifier

Hi

When I generate dts from this js file:

export default class Test {
}

this is the result

// Generate by [js2dts](https://github.com/whxaxes/js2dts#readme)

declare class Test {
}
declare const Test: Test;
export default Test;

in this case the lib is redeclaring the Test variable for nothing (the class is already a variable)
It generates the exception TS2300: duplicate class identifier

Can you look at it ?

Thanks

misenderstanding of the export .. from

The generated dst from this file:

export {default} from './moduleA';

is:

// Generate by [js2dts](https://github.com/whxaxes/js2dts#readme)

declare const default: any;
export default default;

default cannot be used as a variable name
It results a TS error TS1134: Variable declaration expected

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.