This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@nidomiro/ts-type-utils
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

ts-type-utils

npm version

A library containing utilities for typescript.

Content

ModifyTypeOfProperty

Modifies the type of existing properties.

Correct:

type A = {
	a: string
	b: string
}
type ModA = ModifyTypeOfProperty<A, { b: number }>
/*
ModA = {
    a: string,
	b: number,
}
 */

Incorrect:

type A = {
	a: string
	b: string
}
type ModA = ModifyTypeOfProperty<A, { c: number }>
/*
Error:
TS2559: Type '{ c: number; }' has no properties in common with type 'Partial{ a: unknown; b: unknown; }>'.
 */

isNonNilObject

Checks if value is of type 'object' and not (null or undefined)

const a: {} | null | undefined = {}
if (isNonNilObject(a)) {
	// type: a: Record<string, unknown>
}

Development

Building

Run nx build ts-type-utils to build the library.

Running unit tests

Run nx test ts-type-utils to execute the unit tests.

Publish

Make sure you are logged into npm.

Run nx publish ts-type-utils --tag latest --ver x.x.x to publish to npm.

Package Sidebar

Install

npm i @nidomiro/ts-type-utils

Weekly Downloads

9

Version

0.2.0

License

MIT

Unpacked Size

3.8 kB

Total Files

11

Last publish

Collaborators

  • nidomiro