Skip to content

Commit 0c4001a

Browse files
committed
Complex types in TS should extend super type if available
1 parent 23e2276 commit 0c4001a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Templates/TypeScript/src/entity_types.ts.tt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
<#= writer.WriteHeader() #>
1818

19+
export as namespace microsoftgraph;
1920

2021
<# foreach(var enumType in enumTypes) { #>
2122
export type <#= enumType.Name.UpperCaseFirstChar() #> = <#= enumType.GetEnumValues() #>
@@ -39,7 +40,7 @@ export interface <#= entityType.Name.UpperCaseFirstChar() #><# if (entityType.Ba
3940
{
4041
#>
4142

42-
export interface <#= complexType.Name.UpperCaseFirstChar()#> {
43+
export interface <#= complexType.Name.UpperCaseFirstChar()#><# if (complexType.Base != null) { #> extends <#= complexType.Base.Name.UpperCaseFirstChar() #><# }#> {
4344
<# foreach(var prop in complexType.Properties) { #>
4445
<#= prop.Name #>?: <#= prop.GetTypeString() #>
4546
<# } #>

src/GraphODataTemplateWriter/CodeHelpers/TypeScript/TypeHelperTypeScript.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ public static string GetTypeString(this OdcmProperty prop)
4646
case "Boolean":
4747
typeStr = "boolean";
4848
break;
49+
case "Single":
50+
typeStr = "any";
51+
break;
52+
case "Byte": //https://graph.microsoft.io/en-us/docs/api-reference/beta/resources/intune_onboarding_rgbcolor
53+
typeStr = "number";
54+
break;
4955

5056
}
5157
return (prop.IsCollection) ? "[" + typeStr + "]" : typeStr;

0 commit comments

Comments
 (0)