Vscode-ng-language-service: μœ ν˜• κ°€λ“œλŠ” 쀑첩 된 μš”μ†Œμ—μ„œ μΈμ‹λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  2020λ…„ 08μ›” 04일  Β·  3μ½”λ©˜νŠΈ  Β·  좜처: angular/vscode-ng-language-service

버그 μ„€λͺ…

ꡬ성 μš”μ†Œκ°€ μœ ν˜• μˆ μ–΄ (μœ ν˜• 보호)λ₯Ό λ°˜ν™˜ν•˜λŠ” ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜λŠ” 경우 ν•„λ“œκ°€ 있고 μ½”λ“œκ°€ 컴파일 (Angular v8.2)을 μˆ˜ν–‰ν•˜λ”λΌλ„ νŽΈμ§‘κΈ°λŠ” λˆ„λ½ 된 ν•„λ“œμ™€ κ΄€λ ¨λœ 였λ₯˜λ₯Ό ν‘œμ‹œν•©λ‹ˆλ‹€.

μž¬ν˜„ν•˜λ €λ©΄
*ngIf μ—μ„œ μœ ν˜• κ°€λ“œλ₯Ό μ‚¬μš©ν•˜μ‹­μ‹œμ˜€. 쀑첩 된 μš”μ†Œμ—μ„œ κ²°μ •λ˜λŠ” μΈν„°νŽ˜μ΄μŠ€μ˜ ν•„λ“œλ₯Ό μ‚¬μš©ν•΄λ³΄μ‹­μ‹œμ˜€.

// my-model.model.ts
type MyModel = (MyModelA | MyModelB) & { type: 'A' | 'B' };
interface MyModelA {  
  fieldA: any;
}
interface MyModelB {
  fieldB: any;
}
// foo.component.ts
public model: MyModel;
public isModelA(model): model is MyModelA {
  return model.type === 'A';
}

// foo.component.html


md5-1956e8def7f34e35cec69338ae3e15c2


μ˜ˆμƒλ˜λŠ” 행동

νŽΈμ§‘κΈ°μ—λŠ” 였λ₯˜κ°€ μ—†μŠ΅λ‹ˆλ‹€.

bug ivy

λͺ¨λ“  3 λŒ“κΈ€

μœ μ‚¬ν•˜κ²Œ νƒ€μž… κ°€λ“œλŠ” μ–Έμ–΄ μ„œλΉ„μŠ€μ˜ μ»¨ν…μŠ€νŠΈμ— μ μš©λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€ (μ΄κ²ƒμ²˜λŸΌ μ»΄νŒŒμΌν•˜λŠ” λ™μ•ˆ μ μš©λ˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€)

export class NgLetContext<T = any> {
  // allows syntax "foo; let bar"
  $implicit: T = null!;
  // allows syntax "foo as bar"
  ngLet: T = null!;
}
@Directive({
  selector: '[ngLet]',
})
export class NgLetDirective<T> implements OnInit {
  @Input()
  set ngLet(value: T) {
    this.context.$implicit = this.context.ngLet = value;
  }

  constructor(private containerRef: ViewContainerRef, private templateRef: TemplateRef<NgLetContext>) {}
  private context = new NgLetContext<T>();

  static ngTemplateContextGuard<T>(dir: NgLetDirective<T>, ctx: unknown): ctx is NgLetContext<T> {
    return true;
  }

  ngOnInit() {
    this.containerRef.createEmbeddedView(this.templateRef, this.context);
  }
}
interface MyModel  { baz: ExampleValue }
// foo.component.ts
public model: MyModel;
<div *ngLet="model.baz as item">
   {{ item }}
</div>

μ–Έμ–΄ μ„œλΉ„μŠ€ μœ ν˜• (적어도 {{ }} λ‚΄ item μœ„μ— vscode의 툴팁 마우슀 μ˜€λ²„)은 any

컴파일 ν•  λ•Œ μœ ν˜•μ΄ μ˜¬λ°”λ₯΄κ²Œ ExampleValue

μ΄λŠ” 곧 μΆœμ‹œ 될 Ivy-native μ–Έμ–΄ μ„œλΉ„μŠ€ (https://github.com/angular/vscode-ng-language-service/issues/335#issuecomment-693545000 μ°Έμ‘°)μ—μ„œ μˆ˜μ • 될 κ²ƒμ΄μ§€λ§Œ, μš°λ¦¬κ°€ κ³„νšν•˜κ³ μžˆλŠ” 것은 μ•„λ‹™λ‹ˆλ‹€. ν˜„μž¬ μ–Έμ–΄ μ„œλΉ„μŠ€ κ΅¬ν˜„μ˜ 고유 ν•œ μ œν•œμœΌλ‘œ 인해 κ·Έ 전에 μˆ˜μ •ν•˜μ‹­μ‹œμ˜€.

Ayazκ°€ μ–ΈκΈ‰ν–ˆλ“―μ΄μ΄ λ¬Έμ œλŠ” v11.1μ—μ„œ 옡트 인으둜 μΆœμ‹œ 된 μƒˆλ‘œμš΄ μ–Έμ–΄ μ„œλΉ„μŠ€μ—μ„œ ν•΄κ²°λ˜μ—ˆμŠ΅λ‹ˆλ‹€. ν™•μž₯ μ„€μ •μ—μ„œ ν™œμ„±ν™” ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
image

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰