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

[Bug?] 'whitespace' rule threw an error. Line with export * as #322

Open
Toliak opened this issue Feb 17, 2021 · 2 comments
Open

[Bug?] 'whitespace' rule threw an error. Line with export * as #322

Toliak opened this issue Feb 17, 2021 · 2 comments

Comments

@Toliak
Copy link

Toliak commented Feb 17, 2021

Description
Line export * as something from ... throws an error:

The 'whitespace' rule threw an error in 'C:/Users/Toliak/PycharmProjects/mtasa-typescript-wiki-parser/output/index.d.ts':
TypeError: Cannot read property 'forEach' of undefined
    at cb (C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\tslint\lib\rules\whitespaceRule.js:140:45)
    at visitNodes (C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\typescript\lib\typescript.js:27858:30)
    at Object.forEachChild (C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\typescript\lib\typescript.js:28097:24)
    at walk (C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\tslint\lib\rules\whitespaceRule.js:99:8)
    at Rule.AbstractRule.applyWithFunction (C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\tslint\lib\language\rule\abstractRule.js:39:9)
    at Rule.apply (C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\tslint\lib\rules\whitespaceRule.js:41:21)
    at Linter.applyRule (C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\tslint\lib\linter.js:214:29)
    at C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\tslint\lib\linter.js:155:85
    at Object.flatMap (C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\tslint\lib\utils.js:160:29)
    at Linter.getAllFailures (C:\Users\Toliak\PycharmProjects\mtasa-typescript-wiki-parser\output\node_modules\tslint\lib\linter.js:155:32)

Steps to reproduce

  1. Create an empty .d.ts file
  2. Put (you can replace types/mtasa to any other module):
// Minimum TypeScript Version: 3.8

export * as mtasa from 'types/mtasa';
  1. Run dtslint .

Line export * from 'types/mtasa'; works correctly without any errors

Maybe I am missing something?...

@jonnycornwell
Copy link

jonnycornwell commented May 19, 2021

I also hit this when trying to modify some types in definitely typed. Is there any chance of this being investigated?

@Toliak
Copy link
Author

Toliak commented May 19, 2021

@jonnycornwell, There is a "workaround". You can use another way to export anything from a module instead of export * as ... alias.

Example:

import * as something from 'someModule';

export { something };

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

No branches or pull requests

2 participants