mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
This commit addresses a problem where the following would produce a type
error, even though it was valid code:
```typescript
setCanvasData({left: 23})
```
I have changed the argument type for all of the `setXXX` methods which
accept an object as their argument. In the spec files for cropperjs,
@fengyuanchen uses these objects as partials for setters. So I have
made the type definitions follow that same pattern.
I changed the `cropperjs.CropBoxData` type to act the same way as well.
It looks like it was changed at some point, I am guessing to allow it
to be used as a partial in the `setCropBoxData` method. Since, like all
the other data structures here, it contains all members when you `get`
it, I have made all members required parts of the object and changed
the setter method to accept a partial.
I hope this all makes sense. Basically, I went from the first line below
to the second.
```typescript
setXXXXX(thing: cropperjs.SomeInterface): void
setXXXXX(thing: Partial<cropperjs.SomeInterface>): void
```
Then I changed `cropperjs.CropBoxData` to fit this new system.
|
||
|---|---|---|
| .. | ||
| cropperjs-tests.ts | ||
| index.d.ts | ||
| tsconfig.json | ||
| tslint.json | ||