-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong type definition export #33
Comments
Can confirm the same. I found another workaround: import exifRead from 'exif-reader';
// https://github.com/microsoft/TypeScript/issues/52086#issuecomment-1385978414
export const readExif = exifRead as unknown as typeof exifRead.default; |
@Brakebein Can you share your tsconfig.json? I can confirm that the current typing is incorrect, I am just curious why it does not cause problems in my projects. (And sorry for the very late response 😊 ) |
I have a monorepo with a {
"compileOnSave": false,
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"module": "esnext",
"lib": ["es2017", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
},
"exclude": ["node_modules", "tmp"]
}
and {
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist",
"module": "commonjs",
"types": ["node"],
"emitDecoratorMetadata": true,
"target": "es2015"
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
} |
I have created a PR to fix the problem. |
Fix published in v2.0.2 |
The current export of the type definition in
index.d.ts
looks like this:However, the current implementation in
index.js
does not export any default. The type definition should actually look like this (similar to the old type definitions):or you need to adapt the exports in
index.js
appropriately.When I import the library using
import exifReader from 'exif-reader';
I will get following runtime error:It only works when I import and use it the following way:
(I cannot set
"esModuleInterop": true
in tsconfig due to some other library.)The text was updated successfully, but these errors were encountered: