atais / ng2-eonasdan-datetimepicker

A wrapper directive around the Eonasdan Datepicker v4 component.
MIT License
34 stars 23 forks source link

error TS2694: Namespace ''*'' has no exported member 'SetOptions' #53

Closed eriveraa closed 6 years ago

eriveraa commented 6 years ago

Hi, i am using 0.1.3 version of your component, which is really great, but i am having this errors when doint NG SERVE: ( i have followed all your instructions to use this control)

ERROR in node_modules/ng2-eonasdan-datetimepicker/dist/datetimepicker.directive.d.ts(10,29): error TS2694: Namespace '''' has no exported member 'SetOptions'. node_modules/ng2-eonasdan-datetimepicker/dist/datetimepicker.directive.d.ts(12,32): error TS2694: Namespace '''' has no exported member 'Datetimepicker'.

This is my code: import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { SmartadminModule } from '../shared/smartadmin.module'; import { RepActividadComponent } from './rep-actividad.component'; import { RepActividadRouting } from './rep-actividad.routing'; import { AppSharedModule } from '../appshared/appshared.module'; import { SmartadminInputModule } from '../shared/forms/input/smartadmin-input.module'; import { A2Edatetimepicker } from 'ng2-eonasdan-datetimepicker';

@NgModule({ imports: [ CommonModule, SmartadminModule, SmartadminInputModule, RepActividadRouting, AppSharedModule, A2Edatetimepicker ], declarations: [RepActividadComponent] }) export class RepActividadModule { }

My .angular-cli.json: "scripts": [ "../node_modules/jquery/dist/jquery.min.js",
"../node_modules/moment/min/moment.min.js", "../node_modules/moment/locale/es.js", "../node_modules/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js"
],

Could you tell me what i am doing wrong? Thanks in advance.

fetrarij commented 6 years ago

Hello,

Your angular-cli.json seems fine but there are no bootstrap.js imported, but this doesn't have impact with the error. How's your tsconfig.json ? and your src/tsconfig.app.json? You angular version? your eonasdan-bootstrap-datetimepicker version installed? Check if you have node_modules/@types/eonasdan-bootstrap-datetimepicker/index.d.ts installed

eriveraa commented 6 years ago

My answer to @fetraij:

Angular: 5.2.6 From package.json: "ng2-eonasdan-datetimepicker": "^0.1.3",

SRC/TSCONFIG.APP..JSON: { "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/app", "module": "es2015", "baseUrl": "", "types": [] }, "exclude": [ "test.ts", "*/.spec.ts" ] }

TSCONFIG.JSON (Root folder) { "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "baseUrl": "src", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "types": ["node"], "typeRoots": [ "node_modules/@types" ], "lib": [ "es2016", "dom" ] } }

The file: node_modules/@types/eonasdan-bootstrap-datetimepicker/index.d.ts is not present. How do i get it? why is not installed when i install the package with npm?. This step is not on instructions??

Any help will be appreciated, thanks. Waiting for your reply.

fetrarij commented 6 years ago

Do you use typescript version less than 2.0? Because since 2.0, all types should be auto installed. http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html

to fix it, install the type manually:

npm install --save @types/eonasdan-bootstrap-datetimepicker

fetrarij commented 6 years ago

I'm closing this issue because you dont update it. Feel free to reopen if necessary.