filestack / filestack-angular

An official angular component library for the Filestack
MIT License
9 stars 10 forks source link

Issue with Filestack being recognized in Angular 14 #66

Open TravisCallahan opened 7 months ago

TravisCallahan commented 7 months ago

I've been attempting to upgrade an Angular application from 12 to 14 and have been having issues getting filestack to be recognized. Here are a few examples of the errors that I'm receiving:

Error: node_modules/@filestack/angular/projects/filestack-angular/src/lib/filestack-transform.pipe.ts:14:51 - error TS2345: Argument of type 'TransformOptions | undefined' is not assignable to parameter of type 'TransformOptions'.
  Type 'undefined' is not assignable to type 'TransformOptions'.

14     return this.filestackService.transform(value, transformOptions);
                                                     ~~~~~~~~~~~~~~~~

Error: node_modules/@filestack/angular/projects/filestack-angular/src/lib/filestack.service.ts:25:11 - error TS2564: Property 'clientInstance' has no initializer and is not definitely assigned in the constructor.

25   private clientInstance: Client;
             ~~~~~~~~~~~~~~

Error: node_modules/@filestack/angular/projects/filestack-angular/src/lib/filestack.service.ts:27:11 - error TS2564: Property 'clientOptions' has no initializer and is not definitely assigned in the constructor.

27   private clientOptions: ClientOptions;
             ~~~~~~~~~~~~~

Error: node_modules/@filestack/angular/projects/filestack-angular/src/lib/filestack.service.ts:29:11 - error TS2564: Property 'apikey' has no initializer and is not definitely assigned in the constructor.     

29   private apikey: string;

According to the docs, I need to import filestack like so:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { FilestackModule } from '@filestack/angular';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FilestackModule.forRoot({ apikey: YOUR_APIKEY, options: ClientConfig })
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

However I can't even get it to be recognized when I try importing it like that. The only way I've been able to get it to be recognized is by changing the import statement to:

import { FilestackModule } from '@filestack/angular/projects/filestack-angular/src/lib/filestack.module';

AliLozano commented 6 months ago

Hello, I have the same issue with angular 16, any news about this?.

Thanks.

TravisCallahan commented 6 months ago

@AliLozano in our case, we were able to get it to work on Angular 14 by using version 1.4.0 of filestack. I had to do a force npm install.

AliLozano commented 6 months ago

@TravisCallahan Thank you very much, I will do the same