Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useStaticAssets does not exist on type 'INestApplication' #2354

Closed
dchrzanowski opened this issue Jun 6, 2019 · 5 comments
Closed

useStaticAssets does not exist on type 'INestApplication' #2354

dchrzanowski opened this issue Jun 6, 2019 · 5 comments
Labels
needs triage This issue has not been looked into

Comments

@dchrzanowski
Copy link

Bug Report

Current behavior

The console output spits out "error TS2339: Property 'useStaticAssets' does not exist on type 'INestApplication'". The application works just fine, but the error is somehow annoying.

Input Code

In the bootstrap() function

const publicPath = join(__dirname, '../public');
app.useStaticAssets(publicPath);

Expected behavior

No errors should show up.

Possible Solution

Add the useStaticAssets method signature to the nest-application.interface.d.ts

Environment


Nest version: 6.3.1 
Issue seems to exist since 6.0.0
 
For Tooling issues:
- Node version: 11.10
- Platform: Linux

@dchrzanowski dchrzanowski added the needs triage This issue has not been looked into label Jun 6, 2019
@kamilmysliwiec
Copy link
Member

https://docs.nestjs.com/first-steps#platform

const app = await NestFactory.create<NestExpressApplication>(ApplicationModule);

@dchrzanowski
Copy link
Author

Thanks @kamilmysliwiec it seems that in some areas of the docs the "old" version of the factory creation exists.

Anyway, thank you very much for the swift reply.

@Mayjest
Copy link

Mayjest commented Jun 22, 2019

FYI a project generated with the CLI uses the old version too. Or at least it did when I made my project a couple of weeks ago.

@kamilmysliwiec
Copy link
Member

Thanks @kamilmysliwiec it seems that in some areas of the docs the "old" version of the factory creation exists.

Using an interface is optional (only if you need to use express-specific methods). It's not an old version.

@lock
Copy link

lock bot commented Nov 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

3 participants