0

In my asp.net core application, I received the following error when I try to import the Actor class which resides in the folder called Models.

enter image description here

Below, I share the folder structure of the project.

enter image description here

Below is the configuration file for typscript:

enter image description here

Any ideas why I should be receiving this error?

renakre
  • 8,001
  • 5
  • 46
  • 99
  • 1
    You cannot import C# code from typescript – Tom Cumming Mar 28 '19 at 14:38
  • @TomCumming then how do I use these model classes? – renakre Mar 28 '19 at 14:40
  • 1
    the simple way is to just make typescript type declarations with the same shape, I assume you are interoperating with JSON? there are tools to generate these for you like https://github.com/OpenAPITools/openapi-generator if you are using open api – Tom Cumming Mar 28 '19 at 14:42

1 Answers1

1

You cannot use C# classes in typescript. You have to create classes with similar structure in typescript and then use them. Also you can consider using some tools for generating ts classes from C#. This thead might be helpful as well.

Alexander
  • 9,104
  • 1
  • 17
  • 41