Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

"TypeError: Cannot read property 'isDeclarationFile' of undefined" when using typesVersions #153

Closed
leonard-thieu opened this issue Oct 31, 2018 · 1 comment · Fixed by #155

Comments

@leonard-thieu
Copy link
Contributor

Test branch leonard-thieu/DefinitelyTyped#18


When testing the typesVersions feature for @types/jquery, I get errors like:

The 'expect' rule threw an error in '/home/travis/build/leonard-thieu/DefinitelyTyped/types/jquery/ts3.1/JQueryStatic.d.ts':
TypeError: Cannot read property 'isDeclarationFile' of undefined
    at walk (/home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/dtslint/bin/rules/expectRule.js:93:20)
    at applyWithFunction.ctx (/home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/dtslint/bin/rules/expectRule.js:22:62)
    at Rule.AbstractRule.applyWithFunction (/home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/tslint/lib/language/rule/abstractRule.js:39:9)
    at getFailures (/home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/dtslint/bin/rules/expectRule.js:22:25)
    at Rule.applyWithProgram (/home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/dtslint/bin/rules/expectRule.js:24:29)
    at Linter.applyRule (/home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/tslint/lib/linter.js:194:29)
    at /home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/tslint/lib/linter.js:139:85
    at Object.flatMap (/home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/tslint/lib/utils.js:151:29)
    at Linter.getAllFailures (/home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/tslint/lib/linter.js:139:32)
    at Linter.lint (/home/travis/build/leonard-thieu/DefinitelyTyped/node_modules/tslint/lib/linter.js:99:33)

The process I used was:

  • Create a package.json with the following contents:
{
    "private": true,
    "types": "index",
    "typesVersions": {
        ">=3.1.0-0": {
            "*": [
                "ts3.1/*"
            ]
        }
    }
}
  • Create a ts3.1 directory and copy relevant files into there.
  • Remove the header from ts3.1/index.d.ts.
  • Change baseUrl and typeRoots in ts3.1/tsconfig.json to ../../.
@leonard-thieu
Copy link
Contributor Author

leonard-thieu commented Oct 31, 2018

Looks like these errors don't fail the build. Not sure if intentional.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant