dethcrypto / dethcrypto/truffle-typings

Using with power-assert

Open
#17 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
11
Forks
9
PR merge metrics
No merged PRs in 30d

Description

I would like to use [power-assert]( https://github.com/power-assert-js/espower-typescript) for testing, but it conflicts with truffle-typings definitions.

1. You need to require `assert` in your module and the module asserts get rewritten

2. `assert` is already declared by `truffle-typings` as const and cannot be overwritten as import

Any good ideas how to work around this?

```
TSError: ⨯ Unable to compile TypeScript:
test/Token.spec.ts:4:7 - error TS2451: Cannot redeclare block-scoped variable 'assert'.

4 const assert = require("assert"); // Power assert https://github.com/power-assert-js/espower-typescript
~~~~~~

node_modules/truffle-typings/index.d.ts:10:15
10 declare const assert: Chai.AssertStatic;
~~~~~~
'assert' was also declared here.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the compiler error from test/Token.spec.ts and inspect the conflicting declaration in node_modules/truffle-typings/index.d.ts. Trace how the ambient assert declaration is exposed and how power-assert rewrites the required module; done means the TypeScript test setup can use power-assert without TS2451.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.