You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not strictly espower-typescript specific issue, but maybe you can help.
I am using truffle-typing package to bring some TypeScript definitions into my tests. However, these definitions already declare assert from Chai.
If I try to add import assert = require('assert'); in my test.ts, TypeScript compiler will balk.
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.
I was thinking a workaround of using some different symbol for assert from power-assert, e.g.
asrt=require("assert");// Power assert aliased
...but I am not sure if this is going to work due to transpiling.
Can I change the keyword power-assert is using in TypeScript somehow?
Namely, the following does not give me power-assert output:
// test/test.tsimportasrt= require('assert');// If I rename assert -> asrt power-assert is no longer triggereddescribe('Array#join',()=>{it('joins all elements into a string with separator',()=>{asrt(['a','b','c'].join(':')==='a:b:c:');});});
The text was updated successfully, but these errors were encountered:
This is not strictly
espower-typescript
specific issue, but maybe you can help.I am using truffle-typing package to bring some TypeScript definitions into my tests. However, these definitions already declare
assert
from Chai.If I try to add
import assert = require('assert');
in my test.ts, TypeScript compiler will balk.I was thinking a workaround of using some different symbol for
assert
from power-assert, e.g....but I am not sure if this is going to work due to transpiling.
Can I change the keyword power-assert is using in TypeScript somehow?
Namely, the following does not give me power-assert output:
The text was updated successfully, but these errors were encountered: