Ngx-bootstrap: Typings error after updating ng2-b and angular

Created on 15 Sep 2016  路  26Comments  路  Source: valor-software/ngx-bootstrap

[default] project/node_modules/ng2-bootstrap/components/buttons/button-checkbox.directive.d.ts:14:13 Duplicate identifier 'readonly'. [default] project/node_modules/ng2-bootstrap/components/buttons/button-checkbox.directive.d.ts:14:22 '=' expected. [default] project/node_modules/ng2-bootstrap/components/buttons/button-checkbox.directive.d.ts:14:22 Cannot find name 'trueValue'. [default] project/node_modules/ng2-bootstrap/components/buttons/button-checkbox.directive.d.ts:15:13 Duplicate identifier 'readonly'. [default] project/node_modules/ng2-bootstrap/components/buttons/button-checkbox.directive.d.ts:15:22 '=' expected. [default] project/node_modules/ng2-bootstrap/components/buttons/button-checkbox.directive.d.ts:15:22 Cannot find name 'falseValue'. [default] project/node_modules/ng2-bootstrap/components/buttons/button-radio.directive.d.ts:10:14 '=' expected. [default] project/node_modules/ng2-bootstrap/components/buttons/button-radio.directive.d.ts:10:14 Cannot find name 'isActive'. [default] project/node_modules/ng2-bootstrap/components/buttons/button-radio.directive.d.ts:10:22 ';' expected. [default] project/node_modules/ng2-bootstrap/components/dropdown/dropdown-toggle.directive.d.ts:11:14 '=' expected. [default] project/node_modules/ng2-bootstrap/components/dropdown/dropdown-toggle.directive.d.ts:11:14 Cannot find name 'isOpen'. [default] project/node_modules/ng2-bootstrap/components/dropdown/dropdown-toggle.directive.d.ts:11:20 ';' expected. [default] project/node_modules/ng2-bootstrap/components/modal/modal.component.d.ts:15:5 Duplicate identifier 'readonly'. [default] project/node_modules/ng2-bootstrap/components/modal/modal.component.d.ts:15:14 '=' expected. [default] project/node_modules/ng2-bootstrap/components/modal/modal.component.d.ts:15:14 Cannot find name 'isShown'. [default] project/node_modules/ng2-bootstrap/components/modal/modal.component.d.ts:15:21 ';' expected. [default] project/node_modules/ng2-bootstrap/components/modal/modal.component.d.ts:23:13 Duplicate identifier 'readonly'. [default] project/node_modules/ng2-bootstrap/components/modal/modal.component.d.ts:23:22 '=' expected. [default] project/node_modules/ng2-bootstrap/components/position.d.ts:29:13 Duplicate identifier 'readonly'. [default] project/node_modules/ng2-bootstrap/components/position.d.ts:29:22 '=' expected. [default] project/node_modules/ng2-bootstrap/components/position.d.ts:30:13 Duplicate identifier 'readonly'. [default] project/node_modules/ng2-bootstrap/components/position.d.ts:30:22 '=' expected. [default] project/node_modules/ng2-bootstrap/components/tooltip/tooltip-container.component.d.ts:21:14 '=' expected. [default] project/node_modules/ng2-bootstrap/components/tooltip/tooltip-container.component.d.ts:21:14 Cannot find name 'isTemplate'. [default] project/node_modules/ng2-bootstrap/components/tooltip/tooltip-container.component.d.ts:21:24 ';' expected. [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.d.ts:18:14 '=' expected. [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.d.ts:18:14 Cannot find name 'itemTemplate'. [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.d.ts:18:26 ';' expected. [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.d.ts:18:40 Type parameter name cannot be 'any' [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.d.ts:18:44 '(' expected. [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead.directive.d.ts:46:14 '=' expected. [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead.directive.d.ts:46:14 Cannot find name 'matches'. [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead.directive.d.ts:46:21 ';' expected. [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead.directive.d.ts:46:29 Type parameter name cannot be 'any' [default] project/node_modules/ng2-bootstrap/components/typeahead/typeahead.directive.d.ts:46:33 '(' expected.

This appeared after updating to angular 2.0.0 and ng2-bootstrap to 1.1.4, is this supposed to work?

Most helpful comment

Confirmed. Upgrading version of typescript package to "^2.0.0" in package.json does the trick.

All 26 comments

+1

Same here with webpack and RC6 and ng2-bootstrap 1.1.4

(29,22): error TS1005: '=' expected.                                                                                                                                                      
(30,22): error TS1005: '=' expected. 

I have the same problem.
Running 2.0.0-rc.6 with webpack
install ng2-bootstrap 1.1.4

I have the same issue after upgrading to Angular 2.0.0 and ng2-bootstrap 1.1.4.

I have the same issue when upgrade to ver 1.1.4 and angular 2.0 with systemjs

most probably you are using typescript 1.8?

Yes, TypeScript 1.8.10

.d.ts files have changed between ts 1.8 & 2.0.2
for example

    private trueValue;
    private falseValue;
// changed too
    private readonly trueValue;
    private readonly falseValue;

Yeap, I have to update ng2-bootstrap to typescript 2 because angular2 is using ts 2 too already

Confirmed. Upgrading version of typescript package to "^2.0.0" in package.json does the trick.

Hello, I upgrade typescript to 2.0.2 but still meet error

components/buttons/button-checkbox.directive.d.ts(14,22): error TS1005: '=' expected.

@jackyphuong how do you transpile the files ? Some tools (like gulp-typescript) might use an older bundled version of typescript and you'll end up still having the error.

I am using gulp-typescript": "^2.13.6", so is it ok?

@jackyphuong It uses an older version of typescript. You have to explicitly tell it to use something else.
When you create the project, in the task:

 var project = ts.createProject('tsconfig.json',  {
    typescript: require('typescript')
});

That will make it use whatever version you have installed.

Thanks, it worked with me

How do I configure which typescript version to use in WebStorm and Visual Studio?
Have 2.0.2 in devdependencies. Should it be also installed global?

For WebStorm you should be able to change it from Settings => Language & Frameworks => Typescript and you should have a check to use a custom version, where you need to specify the install folder (so yes, might be a good idea to install it globally).

For Visual Studio you need to install the beta version of the plugin. Have a look in the post announcing Typescript 2.0 (or install it globally with npm, it might pick it up right away).

@adrianfaciu thanks for helping guys in solving issues! :)

Thanks, @adrianfaciu

In my case for WebStorm I had to use this path:
C:Users[my_user_name]\AppData\Roaming\npm\node_modules\typescript\lib

For Visual Studio you have to run the installer, just running npm install -g typescript@beta doesn't work even they say it does.

I'm getting these errors as well and using typescript 1.8.10
I don't want to use typescript 2
Is there a way to solve this?
Thanks

@Avien What's wrong with TypeScript 2 ? Angular project itself already uses it...
The only option is to use an older version of ng2-bootstrap, from before it was upgraded to TypeScript 2.

Nothing's wrong - I'm in a middle of a sprint with rough deadlines,
already have a project setup working with ts 1.8,
Cant deal with typescript regressions now

@Avien TypeScript 2 is backward compatible.

No need to change typings configuration and reinstall it?

Typings will work with TypeScript 2 and you can upgrade to @types later.

Then I will try it, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webdev48 picture webdev48  路  3Comments

pgeyman picture pgeyman  路  3Comments

phmello picture phmello  路  3Comments

hugonne picture hugonne  路  3Comments

MrBlaise picture MrBlaise  路  3Comments