RxJs'from'返回类型未知的Observable

时间:2019-12-20 11:09:30

标签: typescript rxjs

import { Tenant } from './tenant';

import { from, Observable } from 'rxjs';

export const testTenants: Tenant[] = [
    {
        'tenant_id': 'ID1'
    }
]

const tenants$: Observable<Tenant>= from(testTenants);

我遇到了错误:

Type 'Observable<unknown>' is not assignable to type 'Observable<Tenant>'

Typescript认为from函数正在返回Observable<unknown>。如何获得将其识别为Observable<Tenant>的信息?

1 个答案:

答案 0 :(得分:1)

您应该使用from tkinter import * from PIL import ImageTk, Image root = Tk() #Setting Tk() as a var root.title("TestTool Reporting") #Title of the GUI root.geometry("325x325") # Size of the GUI #root.iconbitmap(r"logo.ico") root.resizable(0, 0) # Does not allow resizing of the window #def submit(): TO USE LATER # pass ##############FRAMES####################### main_frame = Frame(root) main_frame.grid(row=0, column=0, padx=10, pady=10) # first question q1_label = Label(main_frame, text="Choose T24 Environment") q1_label.grid(column=0, row=0, sticky='w') q1_a = Checkbutton(main_frame, text="R18 VBK TEST2") q1_a.grid(column=0, row=1, sticky='w') q1_b = Checkbutton(main_frame, text="R19 TAFJ") q1_b.grid(column=0, row=2, sticky='w') q1_c = Checkbutton(main_frame, text="R16 TAFJ") q1_c.grid(column=0, row=3, sticky='w') q1_d = Checkbutton(main_frame, text="R18 VBK AML") q1_d.grid(column=0, row=4, sticky='w', pady=(0,20)) ## second question q2_label = Label(main_frame, text="Enter Test type") q2_label.grid(column=0, row=5) q2 = Entry(main_frame) q2.grid(column=0, row=6, pady=(0,20)) # third question q3_label = Label(main_frame, text="which User you used?") q3_label.grid(column=0, row=7, sticky='w') q3_a = Checkbutton(main_frame, text="FT_INPUTTER_1") q3_a.grid(column=0, row=8, sticky='w') q3_b = Checkbutton(main_frame, text="FT_INPUTTER_2") q3_b.grid(column=0, row=9, sticky='w') q3_c = Checkbutton(main_frame, text="FT_AUTHORISER_1") q3_c.grid(column=0, row=10, sticky='w') # fourth question q4_label = Label(main_frame, text="Enter your username:") q4_label.grid(column=1, row=0, sticky='n', padx=(30,0)) q4 = Entry(main_frame, width=15) q4.grid(column=1, row=1, sticky='n', padx=(30,0)) root.mainloop() 而不是of

from