Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typescript-eslint-parser

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-eslint-parser - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

v0.1.1 - August 10, 2016
* 62d14b4 Fix: Class implements generic syntax (fixes #44) (#53) (James Henry)
v0.1.0 - August 9, 2016

@@ -2,0 +6,0 @@

@@ -456,2 +456,38 @@ /**

/**
* Converts a TSNode's typeArguments array to a flow-like typeParameters node
* @param {Array} typeArguments TSNode typeArguments
* @returns {TypeParameterInstantiation} TypeParameterInstantiation node
*/
function convertTypeArgumentsToTypeParameters(typeArguments) {
var firstTypeArgument = typeArguments[0];
var lastTypeArgument = typeArguments[typeArguments.length - 1];
return {
type: "TypeParameterInstantiation",
range: [
firstTypeArgument.pos - 1,
lastTypeArgument.end + 1
],
loc: getLocFor(firstTypeArgument.pos - 1, lastTypeArgument.end + 1, ast),
params: typeArguments.map(function(typeArgument) {
/**
* Have to manually calculate the start of the range,
* because TypeScript includes leading whitespace but Flow does not
*/
var typeArgumentStart = (typeArgument.typeName && typeArgument.typeName.text)
? typeArgument.end - typeArgument.typeName.text.length
: typeArgument.pos;
return {
type: "GenericTypeAnnotation",
range: [
typeArgumentStart,
typeArgument.end
],
loc: getLocFor(typeArgumentStart, typeArgument.end, ast),
id: convertChild(typeArgument.typeName)
};
})
};
}
/**
* Converts a child into a class implements node. This creates an intermediary

@@ -464,3 +500,3 @@ * ClassImplements node to match what Flow does.

var id = convertChild(child.expression);
return {
var classImplementsNode = {
type: "ClassImplements",

@@ -471,2 +507,6 @@ loc: id.loc,

};
if (child.typeArguments && child.typeArguments.length) {
classImplementsNode.typeParameters = convertTypeArgumentsToTypeParameters(child.typeArguments);
}
return classImplementsNode;
}

@@ -473,0 +513,0 @@

2

package.json

@@ -7,3 +7,3 @@ {

"main": "parser.js",
"version": "0.1.0",
"version": "0.1.1",
"files": [

@@ -10,0 +10,0 @@ "lib",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc