I have been utilizing a Visual Studio 2017 extension called TypeScript Definition Generator to automatically create TypeScript interfaces for my MVC-ViewModels. Despite trying various similar tools, they all seem to result in the same output (*.cs.d.ts-File):
declare module server {
interface mycustomtype {
id: any;
description: string;
}
}
In my other TypeScript files, I've experimented with different approaches to using the generated module/type declarations, but each attempt leads to errors:
import { mycustomtype } from '.././../../../../Models/mycustomtype.cs';
The above code triggers an error message stating that mycustomtype
is not recognized as a module. Changing the output of the Definition Generator to export module
helps identify the module but not the type.
Additionally, I also attempted the following method:
/// <reference path=".././../../../../Models/mycustomtype.cs" />
This approach works, however, Visual Studio's intellisense fails to display either server.mycustomtype
or mycustomtype
.
My main query is: How should I properly consume these declared modules? I came across a suggestion in another discussion mentioning that declaring a module without quotes creates an "internal" module. Could this be the issue? Given that multiple TypeScript Definition Generators are producing identical outputs, it seems likely that the problem lies on my end rather than with the generated code.