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

is-immutable-type

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-immutable-type - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

121

package.json
{
"name": "is-immutable-type",
"version": "4.0.0",
"version": "5.0.0",
"description": "Check the immutability of TypeScript types",

@@ -47,81 +47,92 @@ "keywords": [

"cz": "git-cz",
"lint": "pnpm run lint:js && pnpm run lint:md && pnpm run lint:prettier && pnpm run lint:knip && pnpm run lint:spelling && pnpm run lint:packages",
"lint:js": "eslint .",
"lint:js-fix": "eslint . --fix",
"lint": "eslint && pnpm run lint:md && pnpm run lint:spelling && pnpm run lint:knip && pnpm run lint:packages",
"lint-fix": "eslint --fix && pnpm run lint:md-fix && pnpm run lint:packages-fix",
"lint:js": "eslint \"**/*.?([cm])[jt]s?(x)\"",
"lint:js-fix": "eslint \"**/*.?([cm])[jt]s?(x)\" --fix",
"lint:knip": "pnpm run lint:knip:development && pnpm run lint:knip:production",
"lint:knip:development": "knip --exclude exports,nsExports,types,nsTypes",
"lint:knip:production": "knip --production --strict --exclude exports,nsExports,types,nsTypes",
"lint:md": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
"lint:md": "markdownlint-cli2",
"lint:md-fix": "markdownlint-cli2 --fix",
"lint:md-full": "pnpm run lint:md && eslint \"**/*.md\"",
"lint:md-full-fix": "pnpm run lint:md-fix && eslint \"**/*.md\" --fix",
"lint:packages": "pnpm dedupe --check",
"lint:packages-fix": "pnpm dedupe",
"lint:prettier": "prettier \"**/*\" --ignore-unknown --list-different",
"lint:prettier-fix": "prettier \"**/*\" --ignore-unknown --write",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
"lint:yaml": "eslint \"**/*.y?(a)ml\"",
"lint:yaml-fix": "eslint \"**/*.y?(a)ml\" --fix",
"prepare": "husky",
"release": "semantic-release",
"test": "pnpm run test:js",
"test:js": "vitest --coverage --run",
"test:js-limitations": "TEST_LIMITATIONS=1 vitest --coverage --run tests/limitations.test.ts",
"test:js:watch": "vitest",
"type-check": "tsc --noEmit -p tsconfig.build.json"
"test": "pnpm run test:js-run",
"test:js": "vitest --coverage",
"test:js-run": "vitest run --coverage",
"test:js-limitations": "TEST_LIMITATIONS=1 vitest --coverage tests/limitations.test.ts",
"typecheck": "tsc -p tsconfig.build.json --noEmit"
},
"dependencies": {
"@typescript-eslint/type-utils": "^7.2.0",
"@typescript-eslint/type-utils": "^8.0.0",
"ts-api-utils": "^1.3.0",
"ts-declaration-location": "^1.0.0"
"ts-declaration-location": "^1.0.4"
},
"devDependencies": {
"@commitlint/cli": "19.2.1",
"@commitlint/config-conventional": "19.1.0",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@cspell/dict-cryptocurrencies": "5.0.0",
"@rebeccastevens/eslint-config": "2.0.11",
"@rollup/plugin-replace": "5.0.5",
"@rebeccastevens/eslint-config": "3.0.0-next.48",
"@rollup/plugin-replace": "5.0.7",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "12.0.0",
"@semantic-release/commit-analyzer": "13.0.0",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "10.0.2",
"@semantic-release/npm": "12.0.0",
"@semantic-release/release-notes-generator": "13.0.0",
"@types/node": "20.12.2",
"@types/rollup-plugin-auto-external": "2.0.5",
"@typescript-eslint/eslint-plugin": "7.4.0",
"@typescript-eslint/parser": "7.4.0",
"@typescript/vfs": "1.5.0",
"@vitest/coverage-v8": "1.4.0",
"@semantic-release/github": "10.1.3",
"@semantic-release/npm": "12.0.1",
"@semantic-release/release-notes-generator": "14.0.1",
"@stylistic/eslint-plugin": "2.6.1",
"@types/node": "20.12.12",
"@typescript-eslint/eslint-plugin": "8.0.0",
"@typescript-eslint/parser": "8.0.0",
"@typescript/vfs": "1.6.0",
"@vitest/coverage-v8": "2.0.5",
"commitizen": "4.3.0",
"cspell": "8.6.1",
"cspell": "8.13.1",
"cz-conventional-changelog": "3.3.0",
"deassert": "1.0.2",
"dedent": "1.5.1",
"eslint": "8.57.0",
"dedent": "1.5.3",
"eslint": "9.8.0",
"eslint-config-prettier": "9.1.0",
"eslint-flat-config-utils": "0.3.0",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-merge-processors": "0.1.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-functional": "6.4.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "48.2.2",
"eslint-plugin-markdown": "3.0.1",
"eslint-plugin-n": "16.6.2",
"eslint-plugin-format": "0.1.2",
"eslint-plugin-functional": "7.0.0-rc.1",
"eslint-plugin-import-x": "3.1.0",
"eslint-plugin-jsdoc": "48.11.0",
"eslint-plugin-jsonc": "2.16.0",
"eslint-plugin-markdown": "5.1.0",
"eslint-plugin-n": "17.10.1",
"eslint-plugin-no-only-tests": "3.1.0",
"eslint-plugin-optimize-regex": "1.2.1",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-sonarjs": "0.25.0",
"eslint-plugin-unicorn": "51.0.1",
"eslint-plugin-vitest": "0.4.1",
"husky": "9.0.11",
"knip": "5.7.0",
"lint-staged": "15.2.2",
"markdownlint": "0.34.0",
"markdownlint-cli": "0.39.0",
"prettier": "3.2.5",
"prettier-plugin-packagejson": "2.4.14",
"rimraf": "5.0.5",
"rollup": "4.13.2",
"rollup-plugin-auto-external": "2.0.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-promise": "7.0.0",
"eslint-plugin-regexp": "2.6.0",
"eslint-plugin-sonarjs": "1.0.4",
"eslint-plugin-unicorn": "55.0.0",
"eslint-plugin-vitest": "0.5.4",
"eslint-plugin-yml": "1.14.0",
"husky": "9.1.4",
"jsonc-eslint-parser": "2.4.0",
"knip": "5.27.0",
"lint-staged": "15.2.8",
"markdownlint-cli2": "0.13.0",
"prettier": "3.3.3",
"prettier-plugin-packagejson": "2.5.1",
"rimraf": "6.0.1",
"rollup": "4.20.0",
"rollup-plugin-ts": "3.4.5",
"semantic-release": "23.0.6",
"semantic-release": "24.0.0",
"tsc-files": "1.1.4",
"typescript": "5.4.3",
"typescript": "5.5.4",
"vite-tsconfig-paths": "4.3.2",
"vitest": "1.5.0"
"vitest": "2.0.5",
"yaml-eslint-parser": "1.2.3"
},

@@ -132,3 +143,3 @@ "peerDependencies": {

},
"packageManager": "pnpm@8.15.5"
"packageManager": "pnpm@9.6.0"
}

@@ -38,3 +38,8 @@ <div align="center">

```ts
import { getTypeImmutability, Immutability, isReadonlyDeep, isUnknown } from "is-immutable-type";
import {
Immutability,
getTypeImmutability,
isReadonlyDeep,
isUnknown,
} from "is-immutable-type";
import { hasType } from "ts-api-utils";

@@ -45,6 +50,6 @@ import type ts from "typescript";

const typeNodeOrType = hasType(node)
// Use the TypeNode if it's avaliable.
? node.type
// Otherwise, get the Type.
: program.getTypeChecker().getTypeAtLocation(node);
? // Use the TypeNode if it's avaliable.
node.type
: // Otherwise, get the Type.
program.getTypeChecker().getTypeAtLocation(node);

@@ -54,7 +59,7 @@ const immutability = getTypeImmutability(program, typeNodeOrType);

if (isUnknown(immutability)) {
console.log("`immutability` is `Unknown`").
console.log("`immutability` is `Unknown`");
} else if (isReadonlyDeep(immutability)) {
console.log("`immutability` is `ReadonlyDeep` or `Immutable`").
console.log("`immutability` is `ReadonlyDeep` or `Immutable`");
} else {
console.log("`immutability` is `ReadonlyShallow` or `Mutable`").
console.log("`immutability` is `ReadonlyShallow` or `Mutable`");
}

@@ -114,3 +119,8 @@ }

```ts
[{ type: { from: "lib", name: "ReadonlyArray" }, to: Immutability.Immutable, }]
[
{
type: { from: "lib", name: "ReadonlyArray" },
to: Immutability.Immutable,
},
];
```

@@ -125,3 +135,9 @@

```ts
[{ type: { from: "lib", name: "ReadonlyArray" }, to: Immutability.Immutable, from: Immutability.ReadonlyDeep }]
[
{
type: { from: "lib", name: "ReadonlyArray" },
to: Immutability.Immutable,
from: Immutability.ReadonlyDeep,
},
];
```

@@ -159,3 +175,12 @@

```ts
[{ type: { from: "package", package: "type-fest" pattern: /^ReadonlyDeep<.+>$/u }, to: Immutability.Immutable }]
[
{
type: {
from: "package",
package: "type-fest",
pattern: /^ReadonlyDeep<.+>$/u,
},
to: Immutability.Immutable,
},
];
```

@@ -212,2 +237,4 @@

<!-- eslint-disable ts/array-type -->
```ts

@@ -214,0 +241,0 @@ type Foo = ImmutableShallow<readonly string[]>;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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