Reputation: 1759
I'm working on a UI component in VIM with TypeScript plugin that highlights the errors on the spot, so it's not something I get during the actual plugin installation into the app at this point (although I haven't tried yet).
declare module "card-view" {
import view = require("ui/core/view");
export class CardView extends view.View {
}
}
And I get this:
Cannot find module 'ui/core/view'.
I realize that ui/core/view
is unavailable at this point, since it's a standalone plugin, but it will be available at runtime. Is there anything to be done to resolve the error? I must be missing some step that wasn't mentioned in the guide -- http://docs.nativescript.org/plugins/ui-plugin.
UPDATE 1:
When I got to card-view-common.js
implementation I hit another issue. TypeScript expects android
and ios
properties to be implemented, but since the class extends View
(from ui/core/view
) they are supposed to be implemented there. In other words, I believe I still need to somehow point to the existing core module, not sure how though.
Upvotes: 2
Views: 394
Reputation: 1759
Found it. I added a devDependency
to package.json
with tns-core-modules
like below, ran npm install
and then it began recognizing the module. Makes sense if you think about how it is supposed to compile the module during the development phase without installing in the real app, but may be worth mentioning in the guide anyway.
"devDependencies": {
"tns-core-modules": "^1.5.1"
}
Upvotes: 2
Reputation: 115
'ui/core/view'
(and the modules, distributed through the tns-core-modules package are declared as ambient external modules.
It could be that the vim plugin you use does not recognize ambient modules correctly.
Upvotes: 0