Skip to content

Commit 4b85202

Browse files
committed
undeprecate AnyType, AnyC, any
1 parent e312a81 commit 4b85202

File tree

4 files changed

+25
-52
lines changed

4 files changed

+25
-52
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
- undeprecate `FunctionType`, `FunctionC`, `Function`
2020
- undeprecate `NeverType`, `NeverC`, `never`
21+
- undeprecate `AnyType`, `AnyC`, `any`
2122

2223
# 2.2.19
2324

src/index.ts

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,6 +2038,30 @@ export interface NeverC extends NeverType {}
20382038
*/
20392039
export const never: NeverC = new NeverType()
20402040

2041+
/**
2042+
* @since 1.0.0
2043+
*/
2044+
export class AnyType extends Type<any> {
2045+
/**
2046+
* @since 1.0.0
2047+
*/
2048+
readonly _tag: 'AnyType' = 'AnyType'
2049+
constructor() {
2050+
super('any', (_): _ is any => true, success, identity)
2051+
}
2052+
}
2053+
2054+
/**
2055+
* @since 1.5.3
2056+
*/
2057+
export interface AnyC extends AnyType {}
2058+
2059+
/**
2060+
* @category primitives
2061+
* @since 1.0.0
2062+
*/
2063+
export const any: AnyC = new AnyType()
2064+
20412065
// -------------------------------------------------------------------------------------
20422066
// deprecated
20432067
// -------------------------------------------------------------------------------------
@@ -2146,37 +2170,6 @@ export const getDefaultContext /* istanbul ignore next */ = (decoder: Decoder<an
21462170
{ key: '', type: decoder }
21472171
]
21482172

2149-
/**
2150-
* @since 1.0.0
2151-
* @deprecated
2152-
*/
2153-
export class AnyType extends Type<any> {
2154-
/**
2155-
* @since 1.0.0
2156-
*/
2157-
readonly _tag: 'AnyType' = 'AnyType'
2158-
constructor() {
2159-
super('any', (_): _ is any => true, success, identity)
2160-
}
2161-
}
2162-
2163-
/**
2164-
* @since 1.5.3
2165-
* @deprecated
2166-
*/
2167-
// tslint:disable-next-line: deprecation
2168-
export interface AnyC extends AnyType {}
2169-
2170-
/**
2171-
* Use `unknown` instead.
2172-
*
2173-
* @category primitives
2174-
* @since 1.0.0
2175-
* @deprecated
2176-
*/
2177-
// tslint:disable-next-line: deprecation
2178-
export const any: AnyC = new AnyType()
2179-
21802173
/**
21812174
* Use `UnknownRecord` instead.
21822175
*

test/2.1.x/default-types.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -197,44 +197,26 @@ describe('Function', () => {
197197

198198
describe('any', () => {
199199
it('should decode any value', () => {
200-
// tslint:disable-next-line: deprecation
201200
assertSuccess(t.any.decode(null))
202-
// tslint:disable-next-line: deprecation
203201
assertSuccess(t.any.decode(undefined))
204-
// tslint:disable-next-line: deprecation
205202
assertSuccess(t.any.decode('foo'))
206-
// tslint:disable-next-line: deprecation
207203
assertSuccess(t.any.decode(1))
208-
// tslint:disable-next-line: deprecation
209204
assertSuccess(t.any.decode(true))
210-
// tslint:disable-next-line: deprecation
211205
assertSuccess(t.any.decode(t.identity))
212-
// tslint:disable-next-line: deprecation
213206
assertSuccess(t.any.decode({}))
214-
// tslint:disable-next-line: deprecation
215207
assertSuccess(t.any.decode([]))
216-
// tslint:disable-next-line: deprecation
217208
assertSuccess(t.any.decode(/a/))
218209
})
219210

220211
it('should accept any value', () => {
221-
// tslint:disable-next-line: deprecation
222212
assert.ok(t.any.is(null))
223-
// tslint:disable-next-line: deprecation
224213
assert.ok(t.any.is(undefined))
225-
// tslint:disable-next-line: deprecation
226214
assert.ok(t.any.is('foo'))
227-
// tslint:disable-next-line: deprecation
228215
assert.ok(t.any.is(1))
229-
// tslint:disable-next-line: deprecation
230216
assert.ok(t.any.is(true))
231-
// tslint:disable-next-line: deprecation
232217
assert.ok(t.any.is(t.identity))
233-
// tslint:disable-next-line: deprecation
234218
assert.ok(t.any.is({}))
235-
// tslint:disable-next-line: deprecation
236219
assert.ok(t.any.is([]))
237-
// tslint:disable-next-line: deprecation
238220
assert.ok(t.any.is(/a/))
239221
})
240222
})

test/2.1.x/record.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ describe('record', () => {
6262
})
6363

6464
it('should accept an array if the codomain is `any`', () => {
65-
// tslint:disable-next-line: deprecation
6665
const T = t.record(t.string, t.any)
6766
assert.strictEqual(T.is([]), true)
6867
})
@@ -98,7 +97,6 @@ describe('record', () => {
9897
})
9998

10099
it('should decode an array if the codomain is `any`', () => {
101-
// tslint:disable-next-line: deprecation
102100
const T = t.record(t.string, t.any)
103101
assertSuccess(T.decode([1]))
104102
})
@@ -141,7 +139,6 @@ describe('record', () => {
141139
})
142140

143141
it('should accept an array if the codomain is `any`', () => {
144-
// tslint:disable-next-line: deprecation
145142
const T = t.record(t.string, t.any)
146143
const a = [1]
147144
assert.strictEqual(T.encode(a), a)

0 commit comments

Comments
 (0)