Skip to content

Commit

Permalink
type obj
Browse files Browse the repository at this point in the history
  • Loading branch information
ttodua committed Sep 27, 2024
1 parent 55a0998 commit ede4f45
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/csharpTranspiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1070,15 +1070,13 @@ export class CSharpTranspiler extends BaseTranspiler {
modifiers = this.defaultPropertyAccess;
}
// add type
if (!node.type) {
throw new Error('[C#] Class properties can not be transpiled if the property-type is not specified');
}
let typeText = this.getType(node);
if (!typeText) {
if (node.type.kind === ts.SyntaxKind.AnyKeyword) {
typeText = this.OBJECT_KEYWORD + ' ';
} else {
throw new Error('[C#] Unsupported type kind: ' + node.kind);
let typeText = 'object';
if (node.type) {
typeText = this.getType(node);
if (!typeText) {
if (node.type.kind === ts.SyntaxKind.AnyKeyword) {
typeText = this.OBJECT_KEYWORD + ' ';
}
}
}
return modifiers + ' ' + typeText + ' ';
Expand Down

0 comments on commit ede4f45

Please sign in to comment.