Skip to content

Commit 5621cbf

Browse files
committed
TypeScript template updates
1 parent 3b7945b commit 5621cbf

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Templates/TypeScript/src/entity_types.ts.tt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010
var enumTypes = model.GetEnumTypes();
1111
var complexTypes = model.GetComplexTypes();
1212
#>
13+
// Type definitions for the Microsoft Graph API
14+
// Project: https://github.com/microsoftgraph/msgraph-typescript-typings
15+
// Definitions by: Microsoft Graph Team <https://github.com/microsoftgraph>
16+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
17+
1318
<#= writer.WriteHeader() #>
14-
declare namespace MicrosoftGraph {
1519

20+
declare module MicrosoftGraph {
1621
<# foreach(var enumType in enumTypes) { #>
1722
type <#= writer.UpperCaseFirstChar(enumType.Name) #> = <#= enumType.GetEnumValues() #>
1823
<# } #>
@@ -27,7 +32,7 @@ declare namespace MicrosoftGraph {
2732
<#= prop.Name #>?: <#= prop.GetTypeString() #>
2833
<# } #>
2934
}
30-
<#
35+
<#
3136
}
3237
#>
3338
<#
@@ -43,6 +48,6 @@ declare namespace MicrosoftGraph {
4348
<# } #>
4449
}
4550

46-
declare module "msgraph" {
51+
declare module "MicrosoftGraph" {
4752
export = MicrosoftGraph;
4853
}

src/GraphODataTemplateWriter/CodeHelpers/TypeScript/CodeWriterTypeScript.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public CodeWriterTypeScript(OdcmModel model) : base(model) { }
1313

1414
public override String WriteOpeningCommentLine()
1515
{
16-
return "/****************************************************************************" + this.NewLineCharacter;
16+
return "//" + this.NewLineCharacter;
1717
}
1818

1919
public override String WriteClosingCommentLine()
2020
{
21-
return "*****************************************************************************/" + this.NewLineCharacter;
21+
return "//" + this.NewLineCharacter;
2222
}
2323

2424
public override string WriteInlineCommentChar()

src/GraphODataTemplateWriter/CodeHelpers/TypeScript/TypeHelperTypeScript.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ public static string GetTypeString(this OdcmProperty prop)
4545
case "String":
4646
typeStr = "string"; //lowercase
4747
break;
48-
case "DateTimeOffset":
49-
typeStr = "Date";
48+
// all dates need to be of type string so they can be wrapped in new Date(___)
49+
case "DateTimeOffset": // ISO 8601 format in UTC time, ex 2014-01-01T00:00:00Z
50+
case "Date":
51+
typeStr = "string";
5052
break;
5153
case "Boolean":
5254
typeStr = "boolean";

0 commit comments

Comments
 (0)