@ts-type/object-freeze 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/package.json +8 -5
- package/src/index.ts +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.4](https://github.com/bluelovers/ws-ts-type/compare/@ts-type/object-freeze@1.0.3...@ts-type/object-freeze@1.0.4) (2022-10-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### 📌 Dependencies
|
|
11
|
+
|
|
12
|
+
* update deps ([ab5f3e4](https://github.com/bluelovers/ws-ts-type/commit/ab5f3e48da1f10ddd4445ba6dda9a0a68c5f656f))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 🔖 Miscellaneous
|
|
16
|
+
|
|
17
|
+
* . ([ed63e32](https://github.com/bluelovers/ws-ts-type/commit/ed63e326e593f2aac0258db1c6cf15db3d73d943))
|
|
18
|
+
* . ([9219017](https://github.com/bluelovers/ws-ts-type/commit/92190178fcf30f881c1d0d36fb141a3394ab3b38))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [1.0.3](https://github.com/bluelovers/ws-ts-type/compare/@ts-type/object-freeze@1.0.2...@ts-type/object-freeze@1.0.3) (2022-08-10)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @ts-type/object-freeze
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [1.0.2](https://github.com/bluelovers/ws-ts-type/compare/@ts-type/object-freeze@1.0.1...@ts-type/object-freeze@1.0.2) (2022-08-10)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @ts-type/object-freeze
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-type/object-freeze",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "better typescript type for Object.freeze",
|
|
5
5
|
"keywords": [
|
|
6
6
|
".d.ts",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
|
-
"url": "git+https://github.com/bluelovers/ws-ts-type.git"
|
|
38
|
+
"url": "git+https://github.com/bluelovers/ws-ts-type.git",
|
|
39
|
+
"directory": "packages/@ts-type/object-freeze"
|
|
39
40
|
},
|
|
40
41
|
"license": "ISC",
|
|
41
42
|
"author": "bluelovers",
|
|
@@ -64,7 +65,10 @@
|
|
|
64
65
|
"pretest": "echo pretest",
|
|
65
66
|
"test": "echo \"Error: no test specified\"",
|
|
66
67
|
"test:jest": "jest --passWithNoTests",
|
|
68
|
+
"test:jest:snapshot": "yarn run test:jest -- -u",
|
|
67
69
|
"test:mocha": "ynpx --quiet -p ts-node -p mocha mocha -- --require ts-node/register \"!(node_modules)/**/*.{test,spec}.{ts,tsx}\"",
|
|
70
|
+
"test:snapshot": "yarn run test -- -u",
|
|
71
|
+
"test:tsd": "ynpx tsd",
|
|
68
72
|
"test:tsdx": "ynpx @bluelovers/tsdx test --passWithNoTests",
|
|
69
73
|
"posttest": "yarn run build",
|
|
70
74
|
"build": "yarn run build:tsdx && yarn run build:dts:tsc",
|
|
@@ -94,12 +98,11 @@
|
|
|
94
98
|
"tsc:showConfig": "ynpx get-current-tsconfig -p"
|
|
95
99
|
},
|
|
96
100
|
"dependencies": {
|
|
97
|
-
"ts-type": "^
|
|
98
|
-
"tslib": "^2"
|
|
101
|
+
"ts-type": "^3.0.1"
|
|
99
102
|
},
|
|
100
103
|
"packageManager": "yarn@^1.22.11",
|
|
101
104
|
"publishConfig": {
|
|
102
105
|
"access": "public"
|
|
103
106
|
},
|
|
104
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "fa34eea119b9bcbb363061ddffcfe9d78c2d0ddd"
|
|
105
108
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ITSEmptyTuple } from 'ts-type/lib/type/tuple/empty';
|
|
2
|
+
import { ITSToReadonlyArray } from 'ts-type/lib/helper/array/readonly';
|
|
3
|
+
import { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';
|
|
4
|
+
|
|
5
|
+
export function freezeArray<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>
|
|
6
|
+
export function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>
|
|
7
|
+
export function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)
|
|
8
|
+
{
|
|
9
|
+
return Object.freeze(obj)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function freezeObject<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>
|
|
13
|
+
export function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>
|
|
14
|
+
|
|
15
|
+
export function freezeObject<T extends Function>(f: T): T
|
|
16
|
+
export function freezeObject<T extends { [idx: string]: U | null | undefined | object }, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>
|
|
17
|
+
export function freezeObject<T>(o: T): Readonly<T>
|
|
18
|
+
|
|
19
|
+
export function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)
|
|
20
|
+
{
|
|
21
|
+
return Object.freeze(obj)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default freezeObject
|