Skip to content

Commit e497f82

Browse files
committed
Use default tsconfig for tests
1 parent 70826e6 commit e497f82

File tree

8 files changed

+40
-27
lines changed

8 files changed

+40
-27
lines changed

__tests__/Conversion.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('Conversion', () => {
114114
});
115115

116116
it('Converts deep JSON with custom conversion', () => {
117-
const seq = fromJS(js, function (key, sequence) {
117+
const seq = fromJS(js, function (this, key, sequence) {
118118
if (key === 'point') {
119119
// @ts-expect-error -- to convert to real typing
120120
return new Point(sequence);
@@ -130,13 +130,17 @@ describe('Conversion', () => {
130130
it('Converts deep JSON with custom conversion including keypath if requested', () => {
131131
const paths: Array<Array<string | number> | undefined> = [];
132132
// eslint-disable-next-line @typescript-eslint/no-unused-vars
133-
const seq1 = fromJS(js, function (key, sequence, keypath) {
134-
expect(arguments.length).toBe(3);
135-
paths.push(keypath);
136-
return Array.isArray(this[key])
137-
? sequence.toList()
138-
: sequence.toOrderedMap();
139-
});
133+
const seq1 = fromJS(
134+
js,
135+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
136+
function (this: typeof js, key: any, sequence, keypath) {
137+
expect(arguments.length).toBe(3);
138+
paths.push(keypath);
139+
return Array.isArray(this[key])
140+
? sequence.toList()
141+
: sequence.toOrderedMap();
142+
}
143+
);
140144
expect(paths).toEqual([
141145
[],
142146
['deepList'],

__tests__/KeyedSeq.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Range, Seq } from 'immutable';
22
import * as jasmineCheck from 'jasmine-check';
3+
import invariant from '../src/utils/invariant';
34

45
jasmineCheck.install();
56

@@ -36,6 +37,10 @@ describe('KeyedSeq', () => {
3637
const [indexed0, indexed1] = seq
3738
.partition(isEven)
3839
.map((part) => part.skip(10).take(5));
40+
41+
invariant(indexed0, 'indexed0 is not undefined');
42+
invariant(indexed1, 'indexed0 is not undefined');
43+
3944
expect(indexed0.entrySeq().toArray()).toEqual([
4045
[0, 21],
4146
[1, 23],
@@ -64,6 +69,10 @@ describe('KeyedSeq', () => {
6469
const [keyed0, keyed1] = keyed
6570
.partition(isEven)
6671
.map((part) => part.skip(10).take(5));
72+
73+
invariant(keyed0, 'keyed0 is not undefined');
74+
invariant(keyed1, 'keyed1 is not undefined');
75+
6776
expect(keyed0.entrySeq().toArray()).toEqual([
6877
[21, 21],
6978
[23, 23],

__tests__/Map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ describe('Map', () => {
449449

450450
it('uses toString on keys and values', () => {
451451
class A extends Record({ x: null as number | null }) {
452-
toString() {
452+
override toString() {
453453
return this.x;
454454
}
455455
}

__tests__/Seq.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Seq', () => {
3838
});
3939

4040
it('accepts arbitrary objects', () => {
41-
function Foo() {
41+
function Foo(this: { bar: string; baz: string }) {
4242
this.bar = 'bar';
4343
this.baz = 'baz';
4444
}

__tests__/Set.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ describe('Set', () => {
304304
Symbol('a'),
305305
Symbol('b'),
306306
Symbol('c'),
307-
];
307+
] as const;
308308

309309
const symbolSet = Set(manySymbols);
310310
expect(symbolSet.size).toBe(12);

__tests__/merge.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,18 @@ describe('merge', () => {
241241
).toBe(true);
242242
});
243243

244-
const map = { type: 'Map', value: Map({ b: 5, c: 9 }) };
245-
const object = { type: 'object', value: { b: 7, d: 12 } };
244+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
245+
type TypeValue = { type: any; value: any };
246+
247+
const map: TypeValue = { type: 'Map', value: Map({ b: 5, c: 9 }) };
248+
const object: TypeValue = { type: 'object', value: { b: 7, d: 12 } };
246249
const RecordFactory = Record({ a: 1, b: 2 });
247-
const record = { type: 'Record', value: RecordFactory({ b: 3 }) };
248-
const list = { type: 'List', value: List(['5']) };
249-
const array = { type: 'array', value: ['9'] };
250-
const set = { type: 'Set', value: Set('3') };
250+
const record: TypeValue = { type: 'Record', value: RecordFactory({ b: 3 }) };
251+
const list: TypeValue = { type: 'List', value: List(['5']) };
252+
const array: TypeValue = { type: 'array', value: ['9'] };
253+
const set: TypeValue = { type: 'Set', value: Set('3') };
251254

252-
const incompatibleTypes = [
255+
const incompatibleTypes: Array<[TypeValue, TypeValue]> = [
253256
[map, list],
254257
[map, array],
255258
[map, set],

__tests__/tsconfig.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
3-
"noEmit": true,
4-
// TODO: add additional strictness
5-
"strictNullChecks": true,
6-
"strictFunctionTypes": true,
7-
"target": "esnext",
8-
"moduleResolution": "node",
9-
"skipLibCheck": true,
4+
// TODO remove those "false" value that make the code less strict
5+
"noImplicitAny": false,
6+
"verbatimModuleSyntax": false,
107
"paths": {
118
"immutable": ["../type-definitions/immutable.d.ts"],
129
"jasmine-check": ["../resources/jasmine-check.d.ts"]

resources/jestPreprocessor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ const makeSynchronous = require('make-synchronous');
33

44
const TYPESCRIPT_OPTIONS = {
55
noEmitOnError: true,
6-
target: typescript.ScriptTarget.ES2015,
6+
target: typescript.ScriptTarget.ES2022,
77
module: typescript.ModuleKind.CommonJS,
8-
strictNullChecks: true,
98
sourceMap: true,
109
inlineSourceMap: true,
10+
esModuleInterop: true,
1111
};
1212

1313
function transpileTypeScript(src, path) {

0 commit comments

Comments
 (0)