Socket
Socket
Sign inDemoInstall

tsd

Package Overview
Dependencies
Maintainers
2
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsd - npm Package Compare versions

Comparing version 0.11.0 to 0.12.0

dist/lib/assertions/handlers/identicality.d.ts

15

dist/index.js
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
const lib_1 = require("./lib");
__export(require("./lib/assertions/assert"));
__exportStar(require("./lib/assertions/assert"), exports);
exports.default = lib_1.default;

@@ -8,2 +8,8 @@ /**

/**
* Check that the type of `value` is not identical to type `T`.
*
* @param value - Value that should be identical to type `T`.
*/
export declare const expectNotType: <T>(value: any) => void;
/**
* Check that the type of `value` is assignable to type `T`.

@@ -10,0 +16,0 @@ *

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.expectNotDeprecated = exports.expectDeprecated = exports.expectError = exports.expectNotAssignable = exports.expectAssignable = exports.expectNotType = exports.expectType = void 0;
/**

@@ -13,2 +14,12 @@ * Check that the type of `value` is identical to type `T`.

/**
* Check that the type of `value` is not identical to type `T`.
*
* @param value - Value that should be identical to type `T`.
*/
// @ts-ignore
exports.expectNotType = (value) => {
// TODO Use a `not T` type when possible https://github.com/microsoft/TypeScript/pull/29317
// Do nothing, the TypeScript compiler handles this for us
};
/**
* Check that the type of `value` is assignable to type `T`.

@@ -15,0 +26,0 @@ *

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNotAssignable = void 0;
const utils_1 = require("../../utils");

@@ -4,0 +5,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.expectNotDeprecated = exports.expectDeprecated = void 0;
const utils_1 = require("../../utils");

@@ -4,0 +5,0 @@ const expectDeprecatedHelper = (options) => {

export { Handler } from './handler';
export { strictAssertion } from './strict-assertion';
export { isIdentical, isNotIdentical } from './identicality';
export { isNotAssignable } from './assignability';
export { expectDeprecated, expectNotDeprecated } from './expect-deprecated';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Handlers
var strict_assertion_1 = require("./strict-assertion");
exports.strictAssertion = strict_assertion_1.strictAssertion;
var identicality_1 = require("./identicality");
Object.defineProperty(exports, "isIdentical", { enumerable: true, get: function () { return identicality_1.isIdentical; } });
Object.defineProperty(exports, "isNotIdentical", { enumerable: true, get: function () { return identicality_1.isNotIdentical; } });
var assignability_1 = require("./assignability");
exports.isNotAssignable = assignability_1.isNotAssignable;
Object.defineProperty(exports, "isNotAssignable", { enumerable: true, get: function () { return assignability_1.isNotAssignable; } });
var expect_deprecated_1 = require("./expect-deprecated");
exports.expectDeprecated = expect_deprecated_1.expectDeprecated;
exports.expectNotDeprecated = expect_deprecated_1.expectNotDeprecated;
Object.defineProperty(exports, "expectDeprecated", { enumerable: true, get: function () { return expect_deprecated_1.expectDeprecated; } });
Object.defineProperty(exports, "expectNotDeprecated", { enumerable: true, get: function () { return expect_deprecated_1.expectNotDeprecated; } });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.strictAssertion = void 0;
const utils_1 = require("../../utils");

@@ -4,0 +5,0 @@ /**

@@ -6,2 +6,3 @@ import { CallExpression } from '../../../libraries/typescript/lib/typescript';

EXPECT_TYPE = "expectType",
EXPECT_NOT_TYPE = "expectNotType",
EXPECT_ERROR = "expectError",

@@ -8,0 +9,0 @@ EXPECT_ASSIGNABLE = "expectAssignable",

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handle = exports.Assertion = void 0;
const handlers_1 = require("./handlers");

@@ -7,2 +8,3 @@ var Assertion;

Assertion["EXPECT_TYPE"] = "expectType";
Assertion["EXPECT_NOT_TYPE"] = "expectNotType";
Assertion["EXPECT_ERROR"] = "expectError";

@@ -16,3 +18,4 @@ Assertion["EXPECT_ASSIGNABLE"] = "expectAssignable";

const assertionHandlers = new Map([
[Assertion.EXPECT_TYPE, handlers_1.strictAssertion],
[Assertion.EXPECT_TYPE, handlers_1.isIdentical],
[Assertion.EXPECT_NOT_TYPE, handlers_1.isNotIdentical],
[Assertion.EXPECT_NOT_ASSIGNABLE, handlers_1.isNotAssignable],

@@ -19,0 +22,0 @@ [Assertion.EXPECT_DEPRECATED, handlers_1.expectDeprecated],

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDiagnostics = void 0;
const path = require("path");

@@ -4,0 +5,0 @@ const typescript_1 = require("../../libraries/typescript");

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

import { CompilerOptions } from '../../libraries/typescript';
import { Config, RawCompilerOptions } from './interfaces';
import { Config, RawConfig } from './interfaces';
declare const _default: (pkg: {
tsd?: Partial<Config<RawCompilerOptions>> | undefined;
}, cwd: string) => Config<CompilerOptions>;
tsd?: RawConfig;
}, cwd: string) => Config;
/**

@@ -7,0 +6,0 @@ * Load the configuration settings.

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

const pathExists = require("path-exists");
const globby_1 = require("globby");
const globby = require("globby");
const compiler_1 = require("./compiler");

@@ -32,3 +32,3 @@ const config_1 = require("./config");

const testDir = options.config.directory;
let testFiles = yield globby_1.default([testFile, tsxTestFile], { cwd: options.cwd });
let testFiles = yield globby([testFile, tsxTestFile], { cwd: options.cwd });
const testDirExists = yield pathExists(path.join(options.cwd, testDir));

@@ -39,3 +39,3 @@ if (testFiles.length === 0 && !testDirExists) {

if (testFiles.length === 0) {
testFiles = yield globby_1.default([`${testDir}/**/*.ts`, `${testDir}/**/*.tsx`], { cwd: options.cwd });
testFiles = yield globby([`${testDir}/**/*.ts`, `${testDir}/**/*.tsx`], { cwd: options.cwd });
}

@@ -50,6 +50,7 @@ return testFiles;

exports.default = (options = { cwd: process.cwd() }) => __awaiter(void 0, void 0, void 0, function* () {
const { pkg } = yield readPkgUp({ cwd: options.cwd });
if (!pkg) {
const pkgResult = yield readPkgUp({ cwd: options.cwd });
if (!pkgResult) {
throw new Error('No `package.json` file found. Make sure you are running the command in a Node.js project.');
}
const pkg = pkgResult.packageJson;
const config = config_1.default(pkg, options.cwd);

@@ -56,0 +57,0 @@ // Look for a typings file, otherwise use `index.d.ts` in the root directory. If the file is not found, throw an error.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiagnosticCode = void 0;
var DiagnosticCode;

@@ -4,0 +5,0 @@ (function (DiagnosticCode) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseErrorAssertionToLocation = exports.extractAssertions = void 0;
const typescript_1 = require("../../libraries/typescript");

@@ -4,0 +5,0 @@ const assertions_1 = require("./assertions");

@@ -5,2 +5,3 @@ "use strict";

const fs = require("fs");
const globby = require("globby");
const utils_1 = require("../utils");

@@ -19,3 +20,3 @@ /**

const normalizedTypingsFile = path.normalize(typingsFile);
const normalizedFiles = pkg.files.map(path.normalize);
const normalizedFiles = globby.sync(pkg.files, { cwd: context.cwd }).map(path.normalize);
if (normalizedFiles.includes(normalizedTypingsFile)) {

@@ -22,0 +23,0 @@ return [];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tsutils = exports.makeDiagnostic = exports.getJSONPropertyPosition = void 0;
const make_diagnostic_1 = require("./make-diagnostic");

@@ -4,0 +5,0 @@ exports.makeDiagnostic = make_diagnostic_1.default;

import { Node } from '../../../libraries/typescript/lib/typescript';
import { Diagnostic } from '../interfaces';
declare const _default: (node: Node, message: string, severity?: "error" | "warning") => Diagnostic;
declare const _default: (node: Node, message: string, severity?: 'error' | 'warning') => Diagnostic;
/**

@@ -5,0 +5,0 @@ * Create a diagnostic from the given `node`, `message` and optional `severity`.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.expressionToString = exports.resolveJSDocTags = void 0;
const typescript_1 = require("../../../libraries/typescript/lib/typescript");

@@ -4,0 +5,0 @@ /**

@@ -0,0 +0,0 @@ TypeScript is authored by:

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ /*! *****************************************************************************

@@ -0,0 +0,0 @@ Apache License

@@ -0,0 +0,0 @@ /*!----------------- TypeScript ThirdPartyNotices -------------------------------------------------------

{
"name": "tsd",
"version": "0.11.0",
"version": "0.12.0",
"description": "Check TypeScript type definitions",

@@ -16,3 +16,3 @@ "license": "MIT",

"engines": {
"node": ">=6"
"node": ">=8"
},

@@ -44,17 +44,17 @@ "scripts": {

"dependencies": {
"eslint-formatter-pretty": "^1.3.0",
"globby": "^9.1.0",
"meow": "^5.0.0",
"path-exists": "^3.0.0",
"read-pkg-up": "^4.0.0",
"update-notifier": "^2.5.0"
"eslint-formatter-pretty": "^4.0.0",
"globby": "^11.0.1",
"meow": "^7.0.1",
"path-exists": "^4.0.0",
"read-pkg-up": "^7.0.0",
"update-notifier": "^4.1.0"
},
"devDependencies": {
"@types/node": "^11.10.4",
"@types/node": "^14.0.0",
"@types/react": "^16.9.2",
"@types/update-notifier": "^2.2.0",
"ava": "^1.4.1",
"cpy-cli": "^2.0.0",
"del-cli": "^1.1.0",
"execa": "^3.3.0",
"@types/update-notifier": "^4.1.0",
"ava": "^3.8.2",
"cpy-cli": "^3.0.0",
"del-cli": "^3.0.0",
"execa": "^4.0.0",
"react": "^16.9.0",

@@ -61,0 +61,0 @@ "rxjs": "^6.5.3",

@@ -157,2 +157,6 @@ # tsd [![Build Status](https://travis-ci.org/SamVerschueren/tsd.svg?branch=master)](https://travis-ci.org/SamVerschueren/tsd)

### expectNotType&lt;T&gt;(value)
Check that the type of `value` is not identical to type `T`.
### expectAssignable&lt;T&gt;(value)

@@ -159,0 +163,0 @@

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