Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Create local Error interface so that node doesn't need to be externally referenced #1741

Merged
merged 2 commits into from
Nov 19, 2016

Conversation

nchen63
Copy link
Contributor

@nchen63 nchen63 commented Nov 18, 2016

The problem: when using TSLint as an NPM library, you see error:

node_modules/tslint/lib/configuration.d.ts(1,1): error TS2688: Cannot find type definition file for 'node'.

Why: @types/node augments the Error interface that was initially defined by TypeScript's lib.d.ts. Since the use of this interface is exported by TSLint, the app using TSLint must also include @types/node. Sadly, the property added by Node is currently already defined by lib.d.ts

The fix: Don't export the @types/node Error interface and define/use our own similar interface.

@adidahiya adidahiya self-assigned this Nov 18, 2016
@@ -14,6 +14,8 @@
* limitations under the License.
*/

export { Error } from "../configuration";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this compile? This import is just an interface, it doesn't define a call or constructor signature. I think L45 is still referencing node's Error constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arg, you're right

@adidahiya adidahiya merged commit 33019aa into master Nov 19, 2016
@adidahiya adidahiya deleted the error-interface branch November 19, 2016 02:07
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 this pull request may close these issues.

2 participants