tsd
Version:
Check TypeScript type definitions
108 lines (107 loc) • 3.79 kB
JavaScript
/* eslint-disable @typescript-eslint/no-unused-vars */
Object.defineProperty(exports, "__esModule", { value: true });
exports.expectDocCommentIncludes = exports.printType = exports.expectNever = exports.expectNotDeprecated = exports.expectDeprecated = exports.expectError = exports.expectNotAssignable = exports.expectAssignable = exports.expectNotType = exports.expectType = void 0;
/**
* Asserts that the type of `expression` is identical to type `T`.
*
* @param expression - Expression that should be identical to type `T`.
*/
// @ts-expect-error
const expectType = (expression) => {
// Do nothing, the TypeScript compiler handles this for us
};
exports.expectType = expectType;
/**
* Asserts that the type of `expression` is not identical to type `T`.
*
* @param expression - Expression that should not be identical to type `T`.
*/
// @ts-expect-error
const expectNotType = (expression) => {
// eslint-disable-next-line no-warning-comments
// TODO Use a `not T` type when possible https://github.com/microsoft/TypeScript/pull/29317
// Do nothing, the TypeScript compiler handles this for us
};
exports.expectNotType = expectNotType;
/**
* Asserts that the type of `expression` is assignable to type `T`.
*
* @param expression - Expression that should be assignable to type `T`.
*/
// @ts-expect-error
const expectAssignable = (expression) => {
// Do nothing, the TypeScript compiler handles this for us
};
exports.expectAssignable = expectAssignable;
/**
* Asserts that the type of `expression` is not assignable to type `T`.
*
* @param expression - Expression that should not be assignable to type `T`.
*/
// @ts-expect-error
const expectNotAssignable = (expression) => {
// Do nothing, the TypeScript compiler handles this for us
};
exports.expectNotAssignable = expectNotAssignable;
/**
* Asserts that `expression` throws an error. Will not ignore syntax errors.
*
* @param expression - Expression that should throw an error.
*/
// @ts-expect-error
const expectError = (expression) => {
// Do nothing, the TypeScript compiler handles this for us
};
exports.expectError = expectError;
/**
* Asserts that `expression` is marked as `@deprecated`.
*
* @param expression - Expression that should be marked as `@deprecated`.
*/
// @ts-expect-error
const expectDeprecated = (expression) => {
// Do nothing, the TypeScript compiler handles this for us
};
exports.expectDeprecated = expectDeprecated;
/**
* Asserts that `expression` is not marked as `@deprecated`.
*
* @param expression - Expression that should not be marked as `@deprecated`.
*/
// @ts-expect-error
const expectNotDeprecated = (expression) => {
// Do nothing, the TypeScript compiler handles this for us
};
exports.expectNotDeprecated = expectNotDeprecated;
/**
* Asserts that the type and return type of `expression` is `never`.
*
* Useful for checking that all branches are covered.
*
* @param expression - Expression that should be `never`.
*/
const expectNever = (expression) => {
return expression;
};
exports.expectNever = expectNever;
/**
* Prints the type of `expression` as a warning.
*
* @param expression - Expression whose type should be printed as a warning.
*/
// @ts-expect-error
const printType = (expression) => {
// Do nothing, the TypeScript compiler handles this for us
};
exports.printType = printType;
/**
* Asserts that the documentation comment of `expression` includes string literal type `T`.
*
* @param expression - Expression whose documentation comment should include string literal type `T`.
*/
// @ts-expect-error
const expectDocCommentIncludes = (expression) => {
// Do nothing, the TypeScript compiler handles this for us
};
exports.expectDocCommentIncludes = expectDocCommentIncludes;
;