๐๐๐๐๐
whxaxes / js2dts Goto Github PK
View Code? Open in Web Editor NEWd.ts generator for javascript
License: MIT License
d.ts generator for javascript
License: MIT License
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>;
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
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.