Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript compilation error #105

Open
ghost opened this issue Oct 19, 2018 · 7 comments
Open

Typescript compilation error #105

ghost opened this issue Oct 19, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented Oct 19, 2018

I using Angular 6 and after installing "api-ai-javascript": "^2.0.0-beta.14", I get the following errors when attempting ng serve or ng build:
bug

Also I add api-ai-javascript index.ts to my tsconfig files include (tsconfig.app.json and tsconfig.spec.json ).

tsconfig.app.json
{"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"include": [
"/*.spec.ts",
"
/.d.ts",
"../node_modules/api-ai-javascript/index.ts",
"**/
.ts"
],
"exclude": [
"test.ts",
"**/*.spec.ts",

]}

tsconfig.spec.json

{"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"/*.spec.ts",
"
/.d.ts",
"**/
.ts",
"../node_modules/api-ai-javascript/index.ts"
]}
Really I don't know what's the problem.

@heynikhil
Copy link

heynikhil commented Nov 1, 2018

i am having some build error reguarding typescript complitation

Angular Version 7

ERROR in ./node_modules/api-ai-javascript/index.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Users/bhavyadoshi.yudiz/Downloads/chat-plugin-master/node_modules/api-ai-javascript/index.ts is missing from the TypeScript compilation. Pleasemake sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
    at AngularCompilerPlugin.getCompiledFile (/Users/bhavyadoshi.yudiz/Downloads/chat-plugin-master/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:767:23)
    at plugin.done.then (/Users/bhavyadoshi.yudiz/Downloads/chat-plugin-master/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)

@latheesh08
Copy link

I hope it is used for react js projects might not supported for angular

@heynikhil
Copy link

I hope it is used for react js projects might not be supported for angular

no it was supporting before

@madhukosuri
Copy link

I am also facing the same issue with angular 6. Can please let me know anyone of you guys @Devkoja10 @nikhil-1337 @lukesneeringer @latheesh08 @artemgoncharuk How to overcome this situation.

@ghost
Copy link
Author

ghost commented Feb 18, 2019

@madhukosuri I'm sorry for so late response, I was away from the computer.
I didn't find solution for 'dialogflow-javascript-client' that I had , but I found another solution without 'dialogflow-javascript-client'. I hope It will help.

private baseURL: string ='https://api.dialogflow.com/v1/query?v=20150910;`
private token: string = ''; // use your token from dialog flow

getHeaders() {
const headers = new Headers();
headers.append('Authorization', Bearer ${this.token});
return headers;
}

converse(message: string) {
const data = {
query: message,
lang: 'en',
sessionId: '12345'
};
this.http.post(${this.baseURL}, data, { headers: this.getHeaders() }).subscribe(
res => {
const speech = res.json();
});
}
}

@madhukosuri
Copy link

Yes, @Devkoja10 Thanks for your time. It works for me.

@slvamegestic
Copy link

import { ApiAiClient } from "api-ai-javascript";
you should change this import like this for updated API-ai-javascript client
-->import { ApiAiClient } from "api-ai-javascript/es6/ApiAiClient";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants