TypeScript exports is not defined

后端 未结 6 1657
攒了一身酷
攒了一身酷 2020-12-13 08:45

I\'m trying to use export and import but it not working I get an error

Here is my code HTML :




    <         


        
6条回答
  •  無奈伤痛
    2020-12-13 09:16

    Similar to TypedSource's answer, but if you can't or don't want to output into one js file you can do the following:

    
    
    
        
        
    
    
        @RenderBody()
    
        
        
    
    
    

    User.ts :

    class User {
        firstName: string;
        lastName: string;
    }
    

    main.ts

    /// 
    
    // import { User } from "./user"; // not needed if referenced & User.js file is loaded
    console.log(new User());
    

提交回复
热议问题