Closed genru closed 6 years ago
ok I'll check it up
Have you include jweixin.d.ts
to your project folder ?
'include'? I guess no, I do not understand how to do it? I just yarn install
and use it in ts file.
this repo does not support yarn
for now
please follow the install
documentation
thank you for your instruction. unfortunately it does not work, error remains.
I believe yarn
is compatible with npm
, it maybe is not the cause.
belowing are what I followed 1) install jweixin
npm install typed-jweixin --save-dev
2) try to build prject
ng build
I use angular 6, is this a angular 6 compatibility issue?
I'm sorry but yarn
is not compatible with npm
in this case
cause the version in package.json
is 1.0.0-update.1
which yarn
does not support while npm
does
and there should not be any compatibility issues with @angular@6
so just make sure you've include the jweixin.d.ts
in your project
if so please let me know and I'll do some further investigation
could you pop up some error message
that may helps ?
error message shows
ERROR in src/app/rank/rank.component.ts(42,9): error TS2304: Cannot find name 'wx'.
index.d.ts
already exists in node_modules/@types/jweixin
.
does not find jweixin.d.ts
in project folder. hope this helpful.
index.d.ts
already exists innode_modules/@types/jweixin
. does not findjweixin.d.ts
in project folder. hope this helpful.
this is expected that how the declaration file is being included if the node_modules/@types/jweixin/index.d.ts
have the same content with jweixin.d.ts
I'll do some investigation.
PS it's appreciated if you pop up some pieces of your code that errors
I have an component to show rank data. and I need to config wechat jssdk first.
import { Component, OnInit, Inject } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { HttpClient, HttpParams } from '@angular/common/http';
import { environment } from '../../environments/environment';
import { Title, DOCUMENT } from '@angular/platform-browser';
@Component({
selector: 'app-rank',
templateUrl: './rank.component.html',
styleUrls: ['./rank.component.css']
})
export class RankComponent implements OnInit {
type: number;
cate: number;
shopTopPillows = false;
dataSource = [];
showQR = false;
constructor(private route: ActivatedRoute, private http: HttpClient, private titleService: Title
, @Inject(DOCUMENT) private document: any) { }
ngOnInit() {
this.http.get('/wechat/config').subscribe((data: any) => {
wx.config(data); // <--- fail here
});
}
}
this is what i do.
hi @genru I got the tricky 🎉
projects created with ng new
have a ./src/tsconfig.app.json
with default content
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": []
},
"exclude": []
}
just remove the line "types":[]
solves this issue 🤣
thanks for your workaround for this, if some update made to resolve this issue would be great, or consider to update README.
thanks
I follow your sample code in README, without imprt any file and do same thing as you sampled, when I
ng build
, an error displayedit seems wx does not declared, could you update your document to show how to make it work?