我有一个返回一个非常长的无类型对象的函数,我想复制该对象的推断类型,因为手动操作太长了,然后我想创建它的类/接口,例如:
export class PatientTables {
emsf: string;
cadNumber: string;
// and so on
}
Run Code Online (Sandbox Code Playgroud)
有没有办法从某个地方复制它,因为 Visual Studio Code 似乎已经将它分类在某个地方,正如您在图片中看到的(还有 48 个),我怎样才能让它显示其余部分并复制它?谢谢!
我已经结合了 mat-chips 自动完成和输入(因为两者都出现在文档的示例部分),但是它产生了一个问题,当我输入部分自动完成选项来过滤选项,然后单击它时,它会添加输入值加上点击的项目到筹码列表。这对它来说可能是一件非常合乎逻辑的事情,因为我看不出有任何理由为什么它应该在单击项目时忽略模糊事件,是否有内置的方法/黑客来解决这个问题?这是我的代码:
<mat-form-field class="chip-list">
<mat-chip-list #chipList aria-label="Op selection" class="mat-chip-list-stacked">
<mat-basic-chip *ngFor="let sop of selectedOps" [selectable]="selectable"
[removable]="removable" (removed)="remove(sop)">
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
{{sop.val}}
</mat-basic-chip>
</mat-chip-list>
<div style="position: relative;">
<input matInput [formControl]="chipControl" aria-label="subcats" #SelectInput
[matAutocomplete]="auto" [matChipInputFor]="chipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
(matChipInputTokenEnd)="add($event)" [matChipInputAddOnBlur]="addOnBlur">
<mat-icon class="icon" (click)="SelectInput.focus()">keyboard_arrow_down</mat-icon>
</div>
<mat-autocomplete #auto="matAutocomplete">
<mat-option *ngFor="let op of filteredOps | async" [value]="op">
<div (click)="optionClicked($event, op)">
<mat-checkbox [checked]="op.selected" (change)="toggleSelection(op)"
(click)="$event.stopPropagation(); ">
{{ op.val }}
</mat-checkbox>
</div>
</mat-option>
</mat-autocomplete>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)
我做错了什么吗?还是一开始就不应该一起工作?感谢您的任何反馈!