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

typescript-is

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-is - npm Package Compare versions

Comparing version 0.6.7 to 0.7.0

27

lib/transform-inline/visitor.js

@@ -169,3 +169,3 @@ "use strict";

}
function visitNonPrimitive(type, accessor, visitorContext) {
function visitNonPrimitiveType(type, accessor, visitorContext) {
const intrinsicName = type.intrinsicName;

@@ -197,2 +197,21 @@ let conditions;

}
function visitIndexType(type, accessor, visitorContext) {
const typeMapper = visitorContext.typeMapperStack[visitorContext.typeMapperStack.length - 1];
// Using internal TypeScript API, hacky.
let indexedType = type.type;
if (indexedType === undefined) {
throw new Error('Could not get indexed type of index type.');
}
// Make sure we resolve type parameters.
indexedType = typeMapper(indexedType) || indexedType;
const properties = visitorContext.checker.getPropertiesOfType(indexedType);
if (properties.length >= 1) {
return properties
.map((property) => ts.createStrictEquality(accessor, ts.createStringLiteral(property.name)))
.reduce((condition, expression) => ts.createBinary(condition, ts.SyntaxKind.BarBarToken, expression));
}
else {
return ts.createFalse();
}
}
function visitType(type, accessor, visitorContext) {

@@ -249,4 +268,8 @@ if ((ts.TypeFlags.Any & type.flags) !== 0) {

// Non-primitive such as object
return visitNonPrimitive(type, accessor, visitorContext);
return visitNonPrimitiveType(type, accessor, visitorContext);
}
else if ((ts.TypeFlags.Index & type.flags) !== 0) {
// Index type: keyof X
return visitIndexType(type, accessor, visitorContext);
}
else {

@@ -253,0 +276,0 @@ throw new Error('Unsupported type with flags: ' + type.flags);

2

package.json
{
"name": "typescript-is",
"version": "0.6.7",
"version": "0.7.0",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=6.14.4"

Sorry, the diff of this file is not supported yet

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