I'm trying to use chai in typescript.
Chai's javascript example shows this as:
var should = require('chai').should();
I downloaded the type definition:
tsd install chai
...referenced the file, tried to import
/// <reference path='../typings/chai/chai.d.ts' />
import should = require('chai').should();
I get:
error TS1005: ';' expected
...any idea how to do this?
import { should } from 'chai';
should();
The tests for the chai typings do the following:
import chai = require('chai');
var should = chai.should();
Does that work for you?
import { expect } from 'chai';
import 'chai/register-should';
to use both expect
and should
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.