Skip to content

Generated code produces errors when "noImplicitAny": true is used #1

@BendingBender

Description

@BendingBender

We get the following errors when enabling the noImplicitAny option in TypeScript compiler when using the angular2-webpack-starter project:

ERROR in [default] /src/main.browser.ts:26:32 
Parameter 'status' implicitly has an 'any' type.

ERROR in [default] /src/main.browser.ts:31:32 
Parameter 'err' implicitly has an 'any' type.

ERROR in [default] /src/main.browser.ts:31:37 
Parameter 'outdatedModules' implicitly has an 'any' type.

ERROR in [default] /src/main.browser.ts:36:34 
Parameter 'dependencies' implicitly has an 'any' type.

This is caused by code that is being patched in by the hmr-loader into the bootstrapping code. The solution seems simple, add missing any type annotations. However I'm not sure whether this module is used for projects that don't use TypeScript, which would produce syntax errors for them.

A better solution would be to patch in a function call instead of raw code and to hold the implementation of this function inside of this library so that TypeScript won't ever type check the code. But for this I have no idea how to support the different available module systems to import the function that will be patched in.

Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions