shapesecurity / shift-parser-js

ECMAScript parser that produces a Shift format AST
http://shift-ast.org/parser.html
Apache License 2.0
245 stars 28 forks source link

add type info to DefinitelyTyped repo #331

Open simondel opened 7 years ago

simondel commented 7 years ago

Hi! Would it be possible for you to add type for shift-parser and shift-codegen to the DefintelyTyped repo?

I'm one of the developers of the mutation testing framework Stryker and I'm thinking about using shift-parser and shift-codegen instead of esprima and escodegen because of your ES6 support.

Changing our parser/codegenerator is very risky because it lies at the core of what we do: mutating code. Having type information would be very helpful to us. The DefintelyTyped repo on GitHub contains type information for modules which are not written using TypeScript. The typings of esprima may be a useful example. They can be found here.

Some places where we would use the parser, codegenerator and syntax: parserUtils.ts, mutators and MutatorOrchestrator.ts

octogonz commented 5 years ago

+1 Ideally shift would provide first class support for TypeScript and include .d.ts files in the shift-parser package. This would avoid the need for a separate @types/shift-parser package (which otherwise would have to be maintained by a separate group and perhaps lag behind the official API updates).

octogonz commented 5 years ago

@michaelficarra are you still using shift? Besides the lack of typings, the code itself doesn't declare the datatypes for any of the API functions, and I can't find any formal API docs. Also the NPM package doesn't seem to be very widely used. esprima seems way more popular.

michaelficarra commented 5 years ago

@octogonz Yes, we use the Shift tools extensively at @shapesecurity. We don't provide TypeScript types because we don't use TypeScript. You are free to define an external type declaration file, and we may even accept a PR that adds one to this repo.