Skip to content

Commit e312a81

Browse files
committed
- undeprecate NeverType, NeverC, never
1 parent e508b89 commit e312a81

File tree

3 files changed

+33
-47
lines changed

3 files changed

+33
-47
lines changed

CHANGELOG.md

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

1919
- undeprecate `FunctionType`, `FunctionC`, `Function`
20+
- undeprecate `NeverType`, `NeverC`, `never`
2021

2122
# 2.2.19
2223

src/index.ts

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,38 @@ export interface FunctionC extends FunctionType {}
20062006
*/
20072007
export const Function: FunctionC = new FunctionType()
20082008

2009+
/**
2010+
* @since 1.0.0
2011+
*/
2012+
export class NeverType extends Type<never> {
2013+
/**
2014+
* @since 1.0.0
2015+
*/
2016+
readonly _tag: 'NeverType' = 'NeverType'
2017+
constructor() {
2018+
super(
2019+
'never',
2020+
(_): _ is never => false,
2021+
(u, c) => failure(u, c),
2022+
/* istanbul ignore next */
2023+
() => {
2024+
throw new Error('cannot encode never')
2025+
}
2026+
)
2027+
}
2028+
}
2029+
2030+
/**
2031+
* @since 1.5.3
2032+
*/
2033+
export interface NeverC extends NeverType {}
2034+
2035+
/**
2036+
* @category primitives
2037+
* @since 1.0.0
2038+
*/
2039+
export const never: NeverC = new NeverType()
2040+
20092041
// -------------------------------------------------------------------------------------
20102042
// deprecated
20112043
// -------------------------------------------------------------------------------------
@@ -2114,43 +2146,6 @@ export const getDefaultContext /* istanbul ignore next */ = (decoder: Decoder<an
21142146
{ key: '', type: decoder }
21152147
]
21162148

2117-
/**
2118-
* @since 1.0.0
2119-
* @deprecated
2120-
*/
2121-
export class NeverType extends Type<never> {
2122-
/**
2123-
* @since 1.0.0
2124-
*/
2125-
readonly _tag: 'NeverType' = 'NeverType'
2126-
constructor() {
2127-
super(
2128-
'never',
2129-
(_): _ is never => false,
2130-
(u, c) => failure(u, c),
2131-
/* istanbul ignore next */
2132-
() => {
2133-
throw new Error('cannot encode never')
2134-
}
2135-
)
2136-
}
2137-
}
2138-
2139-
/**
2140-
* @since 1.5.3
2141-
* @deprecated
2142-
*/
2143-
// tslint:disable-next-line: deprecation
2144-
export interface NeverC extends NeverType {}
2145-
2146-
/**
2147-
* @category primitives
2148-
* @since 1.0.0
2149-
* @deprecated
2150-
*/
2151-
// tslint:disable-next-line: deprecation
2152-
export const never: NeverC = new NeverType()
2153-
21542149
/**
21552150
* @since 1.0.0
21562151
* @deprecated

test/2.1.x/default-types.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ describe('any', () => {
241241

242242
describe('never', () => {
243243
it('should not decode any value', () => {
244-
// tslint:disable-next-line: deprecation
245244
const T = (t.never as any) as t.Any
246245
assertFailure(T, null, ['Invalid value null supplied to : never'])
247246
assertFailure(T, undefined, ['Invalid value undefined supplied to : never'])
@@ -255,23 +254,14 @@ describe('never', () => {
255254
})
256255

257256
it('should not accept any value', () => {
258-
// tslint:disable-next-line: deprecation
259257
assert.ok(!t.never.is(null))
260-
// tslint:disable-next-line: deprecation
261258
assert.ok(!t.never.is(undefined))
262-
// tslint:disable-next-line: deprecation
263259
assert.ok(!t.never.is('foo'))
264-
// tslint:disable-next-line: deprecation
265260
assert.ok(!t.never.is(1))
266-
// tslint:disable-next-line: deprecation
267261
assert.ok(!t.never.is(true))
268-
// tslint:disable-next-line: deprecation
269262
assert.ok(!t.never.is(t.identity))
270-
// tslint:disable-next-line: deprecation
271263
assert.ok(!t.never.is({}))
272-
// tslint:disable-next-line: deprecation
273264
assert.ok(!t.never.is([]))
274-
// tslint:disable-next-line: deprecation
275265
assert.ok(!t.never.is(/a/))
276266
})
277267
})

0 commit comments

Comments
 (0)