Is there a way to configure Reinforced.Typings to output "export interface" or "export enum" without encapsulating it within a module?

I am currently leveraging Reinforced.Typings for TypeScript model generation from my C# models. My intention is to export the models in a specific format without encapsulation within a module:

export interface IFoobar {
    someProperty: string;
    someOtherProperty: number;
}

export enum SomeEnum {
   someEnumValue = 0,
   someOtherEnumValue = 1
}

Through the following configuration approach, I have been able to achieve almost desired output:

public static void Configure(ConfigurationBuilder builder)
{
    builder.Global(config => config.CamelCaseForProperties()
                                   .AutoOptionalProperties());

    builder.ExportAsInterfaces(new [] { typeof(Foobar) },
                               config => config.WithPublicProperties()
                                               .AutoI()
                                               .DontIncludeToNamespace());

    builder.ExportAsEnums(new [] { typeof(SomeEnum) },
                          config => config.DontIncludeToNamespace());
}

The generated result lacks the export keyword as shown below:

interface IFoobar {
    someProperty: string;
    someOtherProperty: number;
}

enum SomeEnum {
   someEnumValue = 0,
   someOtherEnumValue = 1
}

Is there a way to accomplish my objective without resorting to attributes and continuing to utilize the fluent API?

Answer №1

Experiment with the UseModules() function in your overall configuration settings:

builder.Global(settings => settings.CamelCaseForProperties()
                               .AutoOptionalProperties()
                               .UseModules());

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Performing an UpdateAsync operation in a MongoDb database

In my class structure below, I am facing an issue with calling UpdateAsync by passing only a part of the object. The problem lies in the fact that BsonIgnoreIfDefault is only being respected at the root object level TestObject class, but not on TestProduct ...

Using colored circles in ASP Dropdownlist ListItems (without jQuery): A step-by-step guide

Objective: To create a Dropdown list that displays a green circle if someone's Availability is True, and a red circle if someone's Availability is False. Note: The task needs to be accomplished without the use of jQuery, as it is restricted in t ...

Accordion for the Horizontal and Vertical Orientation

Looking to build a unique horizontal and vertical accordion feature in asp.net. Tried using Ajax Toolkit Accordion but facing issues with changing its orientation: ------- ------- ------- the current design created with ajax toolkit ------- ...

Transform data from various formats such as CSV, Excel, and tab-delimited files into XML

Seeking recommendations for Java or .NET libraries capable of ingesting files in various formats (csv, excel, tab-delimited) and generating an XML file with a specific schema in compliance with an XSD file. Simply creating an XML file won't suffice - ...

Navigating xsd:include XSDs within Visual Studio by incorporating them as embedded resources

I am facing an issue with embedding a set of XSDs as a resource in Visual Studio 2012 .NET. The XSDs validate correctly against XMLSPY and Java code, but when I try to resolve them using a custom XmlResolver to handle xsd:includes, I receive an error stati ...

No data found in the subrow of the datasource after the filter has been

I am working with a material table that has expandable rows. Inside these expanded rows, there is another table with the same columns as the main table. Additionally, I have implemented filters in a form so that when the filter values change, I can update ...

What steps should I take to modify the date format to "dd / mm / yy"?

When using 'toISOString ()' in JavaScript, it appears as shown in photo 2. How can I modify this format? Note: I am working with AngularJs. Image 1 is located in list.component.ts Additional documents: Image 1 Image 2 Image 1: formatDate(e) ...

Tips for transferring data from a view dropdownlist to a controller in ASP.NET MVC without relying on a model class

Controller public ActionResult Isearch( string OFFICE_TYPE,string DEPARTMENT, string FILECATEGORY,string fromdate,string todate) { ViewBag.officetype = new SelectList(entity.TBL_OFFICETYPE.ToList(), "OFID", "OFFICE_TYPE"); ...

Display an image on an HTML page based on the TypeScript data in an Ionic Angular application

After retrieving user profile data from the database and storing it in an observable, I am able to access properties such as profileData.username, profileData.msgnumber, and more. When profileData.avatar returns the name of the avatar the user is using, I ...

Transforming .d.ts files into HTML documentation

I possess a TypeScript declaration file (.d.ts) carefully documenting each function of an API. Can this documentation be elegantly displayed on a website in HTML format? Is there a solution for converting a .d.ts into a visually appealing .html document? ...

What is the best way to merge multiple nested angular flattening operators together?

I am facing a challenge in utilizing the outcomes of Observables from various functions. Some of these functions must be executed sequentially, while others can run independently. Additionally, I need to pass the result of the initial function to some nest ...

What is the recommended practice for closing off datacontext in ASP.net?

Consider the code snippet below: /// <summary> /// Add to view count of this article /// </summary> public static void IncrementViewCount(int articleID) { using (var db = new MainContext()) { var q = (from c in db.tblArticles w ...

In the domain of React and Typescript, a minimum of '3' arguments is anticipated; nonetheless, the JSX factory 'React.createElement' is only equipped with a maximum of '2' arguments. This incongruity is signaled by the

I am facing an error with this particular component: const TheBarTitle = ( theClass: any, columnTitle: string, onClickAction: any, ) => { return ( <div className={theClass} title="Click to add this ...

Is it feasible to process the messages in the exact order they were sent in MSMQ?

Imagine having a queue named Q, which is the designated destination for messages. While MSMQ ensures that multiple messages included in a transaction are received in the same order in which they were sent, my application only sends one message per transa ...

Automatic conversion of datetime field to local time (Unable to modify)

I'm currently following this guide to enhance my understanding of MVC4, but I am encountering difficulties with the Datetime field. Primary Issue: When attempting to input a datetime in the format: DD/MM/YYYY (e.g. 20/06/2012), I receive an error: ...

The ServiceHost directive could not locate the 'SomeService' type specified in the Service attribute value

Just when everything seemed to be running smoothly, a new error started popping up in my service. The build process itself is successful, but for some reason, this error keeps showing up when I try to browse the .svc file. The service is still being hoste ...

How can I convert duplicate code into a function in JavaScript?

I have successfully bound values to a view in my code, but I am concerned about the duplicate nested forEach loops that are currently present. I anticipate that Sonarcube will flag this as redundant code. Can anyone advise me on how to refactor this to avo ...

Using { emitEvent: false } alongside patchValue will not trigger valueChanges on an Angular 4 formgroup

I currently have a formbuilder group where I am monitoring changes using valueChanges. Whenever a change is detected, I trigger a save function and then refresh the form: this.ticketForm.valueChanges.debounceTime(1000).distinctUntilChanged() .subscribe( ...

Issue found in React Js test - TypeError: source.on does not exist as a function

I'm encountering an issue with my post request using multipart/form-data. Everything runs smoothly, except for the tests which are failing. When running the tests, I encounter an error message: TypeError: source.on is not a function. This is the code ...

The process of obtaining the generic return type of a method in a Typescript class that has been instantiated through a factory-like function

The following code example illustrates an issue where TypeScript is unable to infer the generic type U in the fooBar function, leading to the return type of fooRef.doIt() being unknown. What is the reason for this behavior and what modifications are requ ...