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

'maxAge' does not exist in type 'ExpressStaticGzipOptions' #48

Closed
Seanmclem opened this issue Feb 15, 2022 · 2 comments
Closed

'maxAge' does not exist in type 'ExpressStaticGzipOptions' #48

Seanmclem opened this issue Feb 15, 2022 · 2 comments

Comments

@Seanmclem
Copy link

when using a maxAge option in the object as the second arg to expressStaticGzip, I get the TS error 'maxAge' does not exist in type 'ExpressStaticGzipOptions' which is correct. That type is missing from the options-type. Howver, it's used as an example in the readme maxAge: 123,. Which is correct?

@Seanmclem
Copy link
Author

nevermind, the readme clearly says the option was moved to serveStatic

@tkoenig89
Copy link
Owner

tkoenig89 commented Feb 16, 2022

Thanks for your feedback, and glad you found a solution.

I guess you refer to the part of the readme explaining changes between v1 and v2. I see, that it is the first code example, and you feel tempted to use it like it is.

{
    enableBrotli: true,         // not a serverStatic option, will not be moved
    maxAge: 123,                // not copied, as already present. <-- this
    index: 'main.js',           // copied to serveStatic section
    serveStatic: {
        maxAge: 234,            // will be kept 
        cacheControl: false     // will be kept as well
    }
}

Do you think adding something like 'the old way' to the 'wrong' maxAge might help, or should i place the change hint, less prominent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants