目的
CDS の TwoOptions などのフィールドタイプに対応する JS/TS の型をまとめたかった。
Power App component framework で使用できる CDS データ型
マニフェスト定義と生成される JS/TS データ型
前提
$ npm list --depth=0
pcf-project@1.0.0 C:\Users\...
+-- @types/node@10.17.6
+-- @types/powerapps-component-framework@1.2.1
+-- pcf-scripts@1.0.6
`-- pcf-start@1.0.6
挙動
ControlManifest.Input.xml
...
<property name="newAttr1" display-name-key="newAttr1_Display_Key" description-key="newAttr1_Desc_Key" of-type="Currency" usage="bound" required="true" />
<property name="newAttr2" display-name-key="newAttr2_Display_Key" description-key="newAttr2_Desc_Key" of-type="DateAndTime.DateAndTime" usage="bound" required="true" />
<property name="newAttr3" display-name-key="newAttr3_Display_Key" description-key="newAttr3_Desc_Key" of-type="DateAndTime.DateOnly" usage="bound" required="true" />
<property name="newAttr4" display-name-key="newAttr4_Display_Key" description-key="newAttr4_Desc_Key" of-type="Decimal" usage="bound" required="true" />
<property name="newAttr5" display-name-key="newAttr5_Display_Key" description-key="newAttr5_Desc_Key" of-type="Enum" usage="bound" required="true" />
<property name="newAttr6" display-name-key="newAttr6_Display_Key" description-key="newAttr6_Desc_Key" of-type="FP" usage="bound" required="true" />
<property name="newAttr7" display-name-key="newAttr7_Display_Key" description-key="newAttr7_Desc_Key" of-type="Multiple" usage="bound" required="true" />
<property name="newAttr8" display-name-key="newAttr8_Display_Key" description-key="newAttr8_Desc_Key" of-type="OptionSet" usage="bound" required="true" />
<property name="newAttr9" display-name-key="newAttr9_Display_Key" description-key="newAttr9_Desc_Key" of-type="SingleLine.Email" usage="bound" required="true" />
<property name="newAttr10" display-name-key="newAttr10_Display_Key" description-key="newAttr10_Desc_Key" of-type="SingleLine.Phone" usage="bound" required="true" />
<property name="newAttr11" display-name-key="newAttr11_Display_Key" description-key="newAttr11_Desc_Key" of-type="SingleLine.Text" usage="bound" required="true" />
<property name="newAttr12" display-name-key="newAttr12_Display_Key" description-key="newAttr12_Desc_Key" of-type="SingleLine.TextArea" usage="bound" required="true" />
<property name="newAttr13" display-name-key="newAttr13_Display_Key" description-key="newAttr13_Desc_Key" of-type="SingleLine.Ticker" usage="bound" required="true" />
<property name="newAttr14" display-name-key="newAttr14_Display_Key" description-key="newAttr14_Desc_Key" of-type="SingleLine.URL" usage="bound" required="true" />
<property name="newAttr15" display-name-key="newAttr15_Display_Key" description-key="newAttr15_Desc_Key" of-type="TwoOptions" usage="bound" required="true" />
<property name="newAttr16" display-name-key="newAttr16_Display_Key" description-key="newAttr16_Desc_Key" of-type="Whole.None" usage="bound" required="true" />
...
ManifestTypes.d.ts
export interface IOutputs {
newAttr1?: number;
newAttr2?: Date;
newAttr3?: Date;
newAttr4?: number;
newAttr5?: string;
newAttr6?: number;
newAttr7?: string;
newAttr8?: number;
newAttr9?: string;
newAttr10?: string;
newAttr11?: string;
newAttr12?: string;
newAttr13?: string;
newAttr14?: string;
newAttr15?: boolean;
newAttr16?: number;
}