We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
item.ts
// string enum - see https://github.com/Microsoft/TypeScript/issues/3192 function mkenum<T extends {[index: string]: U}, U extends string>(x: T): T { return x; } type enumType<T> = T[keyof T]; export const ItemType = mkenum({ A: "A", B: "B", }); export type ItemType = enumType<typeof ItemType>; export interface Item { name: string; type: ItemType; } export class ItemViewModel { item: Item; get ItemType(): typeof ItemType { return ItemType; } }
item.html
<template> ${item.name} <template if.bind="item.type === ItemType.A"> Aaa </template> <template if.bind="item.type === ItemType.B"> Bbb </template> <template if.bind="item.type === ItemType.C"> Ccc </template> </template>
typeof ItemType is {A: "A", B: "B"} -> ItemType.C should throw a warning.
typeof ItemType
{A: "A", B: "B"}
ItemType.C
The text was updated successfully, but these errors were encountered:
No branches or pull requests
item.ts
item.html
typeof ItemType
is{A: "A", B: "B"}
->ItemType.C
should throw a warning.The text was updated successfully, but these errors were encountered: