Closed
Description
Hello, here is my setup code:
test-setup.ts
import * as snapshotDiff from 'snapshot-diff';
// This is the same function exposed in `enzyme-to-json/serializer' as per README
import { createSerializer } from 'enzyme-to-json';
const enzymeToJsonSerializer = createSerializer();
snapshotDiff.setSerializers([enzymeToJsonSerializer]);
This produces the following error:
error TS2741: Property 'diffOptions' is missing in type 'JestSerializer' but required in type 'Serializer'.
This seems like a mismatch between the Serializer
type in this repository and the JestSerializer
type from enzyme-to-json
.
My understanding is that a serializer should only have two required properties (print
and test
) so perhaps diffOptions
needs to be optional? Note that it appears the source code expects it to be optional already
If I try to make that change I get:
error TS2322: Type 'JestSerializer' is not assignable to type 'Serializer'.
Types of property 'print' are incompatible.
Type '(CommonWrapper: CommonWrapper<{}, {}, Component<{}, {}, any>>, serializer: JestSerializer) => Json' is not assignable to type '(value: any, _serializer?: Function | undefined) => string'.
Types of parameters 'serializer' and '_serializer' are incompatible.
Type 'Function | undefined' is not assignable to type 'JestSerializer'.
Type 'undefined' is not assignable to type 'JestSerializer'.
Let me know if I can provide further debugging help, thanks
Metadata
Metadata
Assignees
Labels
No labels