Closed wohugb closed 6 years ago
I have cloned this repo in a new folder:
git clone https://github.com/surveyjs/surveyjs_angular_cli.git
run
npm i
and then
npm start
and it works for me on "http://localhost:4200/".
What are your steps to reproduce the issue?
node_modules/surveyjs-editor/surveyeditor.d.ts (141,18): Cannot find name 'KnockoutObservable'. what could be wrong?
@starday Do you have the "surveyjs_angular_cli\node_modules\@types\knockout\" folder afer "npm i" command? If no, you can install it vua "npm i @types/knockout" command.
@tsv2013 thanks for your response for still have the issue after running npm install @types/knockout
@starday Can you try npm i @types/knockout
?
@starday Do you have the "surveyjs_angular_cli\node_modules\@types\knockout" folder afer "npm i" command?
@tsv2013 yes i do have \node_modules@types\knockout. I don't know if it could be because am running it against angular 4 app.
@starday I have @angular/cli@1.0.0
installed globally. And "version": "4.1.2" of "name": "@angular/core" package.
This looks like a problem purely with the surveyjs-editor
package. All you have to do is include it and it tries to use some exported classes from its survey-knockout
package dependency that this dependency doesn't actual declare or export.
VSCode warning us there is nothing named KnockoutObservable.
Confirming there is nothing called KnockoutObservable in the survey-knockout
package.
Looking through the commits on this repository I see that knockout
needs to be added to the the types
array in app/tsconfig.app.ts
.
That was my missing step as I'm building this from scratch and that direction is not in the README.
@rjsteinert Yes, I've missed this step in the README. Thank you for your help! I'll update the README. I 'd like to ask you - what is if you just clone this repo and run npm start
after npm i
? Because I tried exact this scenario and have not managed to reproduce the compilation error.
@rjsteinert I've updated README. Thank you again.
Thanks @rjsteinert!
Having this error on survey.angular.d.ts. I have added types: knockout to tsconfig.app.json
ERROR in node_modules/survey-angular/survey.angular.d.ts(606,14): error TS2304: Cannot find name 'KnockoutObservable'. node_modules/survey-angular/survey.angular.d.ts(607,17): error TS2304: Cannot find name 'KnockoutComputed'. node_modules/survey-angular/survey.angular.d.ts(608,13): error TS2304: Cannot find name 'KnockoutComputed'. node_modules/survey-angular/survey.angular.d.ts(609,19): error TS2304: Cannot find name 'KnockoutObservable'.
In src/polyfills.ts add
import * as ko from 'knockout'; window['knockout'] = ko;
I worked for me.