Skip to content
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

Compilation in typescript project with 'noImplicitAny: true' fails because of implict any in tinyld #9

Closed
leonardlin opened this issue Jan 22, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@leonardlin
Copy link

Using tinlyd: 1.2.2

Steps:

  • include tinyld in a project that uses typescript setting noImplicitAny: true
  • run the typescript compiler (ie tcs )

Expected

  • It runs through

Actual

  • An error is thrown

node_modules/tinyld/src/core.ts:59:18 - error TS7018: Object literal's property 'only' implicitly has an 'any[]' type. 59 const data = { only: [], verbose: false } ~~~~~~~~

I will create a PR to address this.

@kefniark
Copy link
Contributor

that's an interesting one, I setup a more strict TS config

    "strict": true,
    "noImplicitAny": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "strictBindCallApply": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,

and yarn test:types which is running typescript compiler still doesn't complain about it when it complain in your project 🤔

@kefniark kefniark self-assigned this Jan 22, 2022
@kefniark kefniark added the bug Something isn't working label Jan 22, 2022
@kefniark
Copy link
Contributor

kefniark commented Jan 22, 2022

I created a brand new project with noImplicitAny: true and I dont have any issue.
By any chance, can you provide me your tsconfig.json ?

It seems to be caused by the fact I directly point at typescript files and not use dedicated declaration files.
They are compile with the typescript config of the host project and not the one of the library, which can cause issues like this one.
I will check if I cannot remove the src/ and test/ folders from npm and only upload a types/

@kefniark
Copy link
Contributor

I just published a new version on npm tinyld@1.2.3

It should solve your problem and make the usage of the lib easier

@leonardlin
Copy link
Author

thanks so much, I suspect it's related to the typescript version.
"implicitAny" checks got better and stricter with new versions.

I try the latest tinyld version and report back here.

@leonardlin
Copy link
Author

leonardlin commented Jan 22, 2022

The latest version works.
Thanks for fixing so quickly.

my tsconfig:

{
    "compilerOptions": {
        "module": "commonjs",
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "target": "es6",
        "declaration": true,
        "declarationMap": true,
        "lib": ["es6", "dom"],
        "noImplicitAny": true,
        "resolveJsonModule": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "moduleResolution": "node",
        "sourceMap": true,
        "outDir": "dist",
        "baseUrl": ".",
        "paths": {
            "*": [
                "node_modules/*",
                "src/types/*"
            ]
        }
    },
    "include": [
        "src/**/*",
    ],
    "exclude": [
        "src/**/*.spec.ts"
    ]
}

@kefniark
Copy link
Contributor

Thanks for your time and I'm really sorry for the different problems you run into 🤕

I will try to improve the flow and the documentation to make sure contributing to the project become a better process.

@leonardlin
Copy link
Author

what are you talking about,
Thank you for this amazing lib!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants