Coder Social home page Coder Social logo

Comments (4)

peterblazejewicz avatar peterblazejewicz commented on May 26, 2024 1

Hey,
it means, that TS node configuration is not including 'express-session-types',
you need make sure 'express-session-types' are included in your compilation. My guess is tsc resolves 'express-session' only to 'node_modules/@types/express-session' and no declaration is read from 'express-session-types'

from typescript-node-starter.

peterblazejewicz avatar peterblazejewicz commented on May 26, 2024 1

in your current project, make sure the code that augments 'express-session' (adding 'returnTo') is included, e.g. you can import this code into entry module. The case is to force 'tsc' to properly resolve 'express-session' first (@types/express-session) and next 'express-session' augmentation code. This setup has to work for both regular and 'ts-node' setup. 'ts-node'' has special syntax to resolve deps properly (e.g. to read dedicated tsconfig). I think this is the problem. The example here ('express-session-types') is use-case specific example on how to incorporate 'returnTo' property.

from typescript-node-starter.

DerianCordobaPerez avatar DerianCordobaPerez commented on May 26, 2024 1

Thank you very much for this resolution, indeed the solution was to force the import within the app.ts file in the following way. ❤️

import * as sessionTypes from './types/express-session-types';

from typescript-node-starter.

DerianCordobaPerez avatar DerianCordobaPerez commented on May 26, 2024

Indeed, but when doing it either with typeRoot or including the types, it takes by default the ones from the types folder inside the src and not the node_modules, sometimes the express-session call inside the app.ts file has no effect because it is not callable.

When trying to do the following

app.use(session({
    resave: true,
    saveUninitialized: true,
    secret: SESSION_SECRET,
    store: new MongoStore({
        mongoUrl,
        mongoOptions: {
            autoReconnect: true
        }
    })
}));

The following error occurs, so even if the call to the types is made, the execution in development mode still does not work.

This expression is not callable.

from typescript-node-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.