该表达式应具有'obj'类型,但此处具有'string'类型

时间:2019-02-04 14:16:13

标签: f#

以下代码具有类型错误,例如“此表达式的类型应为'obj',但此处的类型为'string'“

    let fiveDaysForecast (model: CityForecast) = 
        let fiveDays = model.Days |> List.truncate 5
        let city = if model.Country |> String.IsNullOrWhiteSpace then model.City else sprintf "%s, %s" model.City model.Country 
        View.StackLayout(padding = 20.0, verticalOptions = LayoutOptions.FillAndExpand,
            children = [ 
                View.Label(text=city.ToUpper(), textColor=Color.Beige, backgroundColor=Color.FromHex("#0F4D8FAC"), fontSize=40, fontAttributes=FontAttributes.Bold, horizontalTextAlignment=TextAlignment.Center)
                empty 20.
                View.Grid(
                    rowdefs=["*"],
                    coldefs=[ for _ in fiveDays -> "*" ],
                    children = (fiveDays |> List.mapi (day 0) ) )
                ])

由于coldefs=[ for _ in fiveDays -> "*" ],而导致此代码行"*"出错

我该如何解决?

1 个答案:

答案 0 :(得分:3)

根据精彩指南(https://fsprojects.github.io/Fabulous/views-perf.html),您需要将列表元素装箱:

curl -X POST -k -H 'Content-Type: application/x-www-form-urlencoded' \
-i 'https://authserver/auth/realms/{realm}/protocol/openid-connect/logout' \
--data 'username=abc&password=def&client_id=client-id&grant_type=refresh_token&client_secret=a682049d-587c-4c38-a594-814f08b0ca7&refresh_token=<refresh_token>'