I am in a process of rewriting my node.js app in typescript, and I've stumbled across a bunch of index.js files, which have a following construct:
module.exports = {
query: require('./query'),
mutation: require('./mutation')
}
which is later imported like this:
const { query } = require './module';
I tried to rewrite it like this:
import {query} from './query'
import {mutation} from './mutation'
export default {
query,
mutation
}
but then I can't access the query object by import {query} from './query';
How can I successfully convert the following structure to ts, so that I don't have to import the whole module? Thanks!
you need to do export { query, mutation, }
default is for only one export general like object