fix(v032): AiWorker Promise.all closure type narrowing 회복
Task 6 의 Promise.all 도입 시 async callback closure 가 this.telemetry? narrowing 잃어 TS2532 발생. const telemetry = this.telemetry 로 narrowed reference capture 후 closure 안에서 사용.
This commit is contained in:
@@ -176,7 +176,8 @@ export class AiWorker {
|
|||||||
candidatesCount: candidates.length
|
candidatesCount: candidates.length
|
||||||
});
|
});
|
||||||
if (this.telemetry) {
|
if (this.telemetry) {
|
||||||
await this.telemetry.emit({
|
const telemetry = this.telemetry;
|
||||||
|
await telemetry.emit({
|
||||||
kind: 'ai_succeeded',
|
kind: 'ai_succeeded',
|
||||||
payload: {
|
payload: {
|
||||||
noteId: job.noteId,
|
noteId: job.noteId,
|
||||||
@@ -192,13 +193,13 @@ export class AiWorker {
|
|||||||
if (vocabSet.has(tagName.toLowerCase())) {
|
if (vocabSet.has(tagName.toLowerCase())) {
|
||||||
const tagId = this.repo.getTagIdByName(tagName);
|
const tagId = this.repo.getTagIdByName(tagName);
|
||||||
if (tagId !== null) {
|
if (tagId !== null) {
|
||||||
await this.telemetry.emit({
|
await telemetry.emit({
|
||||||
kind: 'tag_vocab_hit',
|
kind: 'tag_vocab_hit',
|
||||||
payload: { tagId, vocabSize: vocab.length }
|
payload: { tagId, vocabSize: vocab.length }
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await this.telemetry.emit({
|
await telemetry.emit({
|
||||||
kind: 'tag_vocab_miss',
|
kind: 'tag_vocab_miss',
|
||||||
payload: { vocabSize: vocab.length }
|
payload: { vocabSize: vocab.length }
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|||||||
Reference in New Issue
Block a user