joshbuddy / exif-be-gone

Remove exif data using a node.js transform stream
34 stars 4 forks source link

fix: types #22

Closed hrishikesh-k closed 1 year ago

hrishikesh-k commented 1 year ago

This PR fixes reported by TypeScript when building with exactOptionalPropertyTypes: true and issues with override keyword:

node_modules/exif-be-gone/index.ts:16:5 - error TS2412: Type 'undefined' is not assignable to type 'number' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target.

16     this.remainingBytes = undefined
       ~~~~~~~~~~~~~~~~~~~

node_modules/exif-be-gone/index.ts:20:3 - error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'Transform'.

20   _transform (chunk: any, _: string, callback: TransformCallback) {
     ~~~~~~~~~~

node_modules/exif-be-gone/index.ts:25:3 - error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'Transform'.

25   _final (callback: TransformCallback) {
     ~~~~~~

node_modules/exif-be-gone/index.ts:74:9 - error TS2412: Type 'undefined' is not assignable to type 'number' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target.

74         this.remainingBytes = undefined
           ~~~~~~~~~~~~~~~~~~~

node_modules/exif-be-gone/index.ts:83:7 - error TS2412: Type 'undefined' is not assignable to type 'number' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target.

83       this.remainingBytes = undefined
         ~~~~~~~~~~~~~~~~~~~
joshbuddy commented 1 year ago

Hey @Hrishikesh-K, this looks like a good change. I think if you're doing this though, you can drop the ? on the property type as its always present.

As well, you removed the newline from index.ts, I think the linter is complaining about that.

hrishikesh-k commented 1 year ago

Changes made!

joshbuddy commented 1 year ago

Thank you! :D Merging and releasing