I am tried write custom module to this confirmation-plugin . And during compiling ts, throw exception Property confirmation does not exist on type 'JQuery' . This is my code blocks:
-ts.config
{
"include": ["./app/Resources/public/ts/*" ],
"compilerOptions": {
"sourceMap": true,
"target": "es5",
"allowJs": true,
"removeComments": true,
"lib": ["es6", "dom", "dom.iterable"],
"typeRoots" : ["node_modules/@types", "./app/Resources/public/ts/types"]
}
}
module
declare module 'bs-confirmation' {
interface JQuery {
confirmation: any;
}
}
my-script
private againInitConfirmation() {
$('[data-toggle=confirmation]').confirmation({
rootSelector: '[data-toggle=confirmation]',
}); // error Property confirmation does not exist on type 'JQuery<HTMLElement>'
}
dir-structure
-ts-config
-app
-Resources
-public
-ts
*ts-files
-types
bs-confirmation.ts
-node_modules
-etc.
When i copy and past bs-confirmation.ts to node_modules/@types/etc. and add ///<reference types="jquery"/>
this is working. What am i doing wrong ? What to do to make it work in a custom directory ? Sorry my bad english . Best regards. Andrew