Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing Chai in Typescript

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?

like image 985
Allyl Isocyanate Avatar asked Jul 21 '15 05:07

Allyl Isocyanate


2 Answers

import { should } from 'chai';
should();
like image 79
Tiago Bértolo Avatar answered Sep 21 '22 13:09

Tiago Bértolo


The tests for the chai typings do the following:

import chai = require('chai');
var should = chai.should();

Does that work for you?

like image 28
Vadim Macagon Avatar answered Sep 20 '22 13:09

Vadim Macagon