Javascript 类型';无效';没有属性';水滴';并且没有字符串索引签名
更新1:我根据Pankaj的答案更新了代码Javascript 类型';无效';没有属性';水滴';并且没有字符串索引签名,javascript,html,angular,typescript,rxjs,Javascript,Html,Angular,Typescript,Rxjs,更新1:我根据Pankaj的答案更新了代码 嘿,我在代码库中更新了你的代码…但我仍然收到这样的错误…任何想法…在分号[ts]属性赋值的末尾都是预期的。 Observable.fromEvent( $("#AnimalRatsGrid .RatNameFile"), "click") .do((e) => { console.log("I am here"); alert("I am here");
嘿,我在代码库中更新了你的代码…但我仍然收到这样的错误…任何想法…在分号[ts]属性赋值的末尾都是预期的。
Observable.fromEvent( $("#AnimalRatsGrid .RatNameFile"), "click")
.do((e) => {
console.log("I am here");
alert("I am here");
kendo.ui.progress($("#loading"), true);
}).map(e => "Rats/color/black?RatId="+"7887878787")
.mergeMap(vals => that.nbcuService.getResponse(vals, 'get', ""))
//.map(data => { blob: new Blob([data], { type: 'application/octet-stream' }), fire: "untitled1.txt" })
.map(data => {
//creating customData object
let customData: any = {
blob: new Blob([data],
{
type: 'application/octet-stream'
}),
fire: "untitled1.txt" //
};
return customData; //returning it from map.
})
.subscribe(
({blob, fire}) => that.nbcuService.saveAs(blob,fire),
err => { }
);
});
- 我正在努力学习rxjs
- 所以我包括了rxjs方法
- 但是我的VisualStudio中有三个错误 /[ts]未使用的标签。 //[ts]找不到名称“fire”。是否有 //[ts]类型“void”没有属性“blob”和字符串索引签名。
- 你能告诉我怎么修理吗
- 下面提供我的相关代码
- 我在要点中给出的全部代码
Observable.fromEvent($(“#AnimalRatsGrid.RatNameFile”),“单击”)
.do((e)=>{
console.log(“我在这里”);
警惕(“我在这里”);
kendo.ui.progress($(“#加载”),true;
}).map(e=>Rats/color/black?RatId=“+”788787”)
.mergeMap(VAL=>that.sportsservice.getResponse(VAL,'get',“”)
.map(数据=>{
blob:新blob([数据],//[ts]未使用的标签。
{
类型:“应用程序/八位字节流”
}),
fire:“untitled1.txt”//[ts]找不到名称“fire”。是否有
})
.订阅(
//[ts]类型“void”没有属性“blob”和字符串索引签名。
({
水滴,
火
})=>that.sportsservice.saveAs(blob,fire),
错误=>{}
);
});
Typescript正在叫喊,因为可观察的最后一部分,即映射
函数不会返回任何无效的对象。当lambda表达式类似于.map(item=>item.someProp)
时,lambda隐式返回RHS,当在lambda函数中使用{}
(括号)时,必须显式地从函数返回所需的结果
.map(data => {
//creating customData object
let customData: any = {
blob: new Blob([data],
{
type: 'application/octet-stream'
}),
fire: "untitled1.txt" //
};
return customData; //returning it from map.
})
Typescript正在叫喊,因为可观察的最后一部分,即map
函数不会返回任何void
对象。当lambda表达式类似于.map(item=>item.someProp)
时,lambda隐式返回RHS,当在lambda函数中使用{}
(括号)时,必须显式地从函数返回所需的结果
.map(data => {
//creating customData object
let customData: any = {
blob: new Blob([data],
{
type: 'application/octet-stream'
}),
fire: "untitled1.txt" //
};
return customData; //returning it from map.
})
嘿,我在代码库中更新了你的代码…但我仍然收到这样的错误…任何想法…在分号[ts]属性赋值的结尾处,这是预期的。--------->更新问题中的代码嘿,我在代码库中更新了你的代码…但是我仍然收到这样的错误…任何想法…在分号[ts]的结尾处应为属性赋值。------->也更新问题中的代码