Skip to content

Commit

Permalink
Merge pull request #1724 from Tobbe/tobbe-routerdts-format
Browse files Browse the repository at this point in the history
Format generated *.d.ts files
  • Loading branch information
Tobbe authored Feb 4, 2021
2 parents 19bb1b5 + 3f00114 commit 2f44c51
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ export default function ({ types: t }: { types: typeof types }): PluginObj {
const typeDefContent = `
// @ts-expect-error
declare module '${importGlob.replace('../', 'src/')}';
`
`
.split('\n')
.slice(1)
.map((line) => line.replace(' ', ''))
.join('\n')
generateTypeDef(`import-dir-${importName}.d.ts`, typeDefContent)
generateTypeDefIndex()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,20 @@ export default function (
const typeDefContent = `
declare module '@redwoodjs/router' {
interface AvailableRoutes {
${availableRoutes.join('\n')}
${availableRoutes.join('\n ')}
}
}
${pageImports.join('\n')}
declare global {
${pageGlobals.join('\n')}
${pageGlobals.join('\n ')}
}
`
`
.split('\n')
.slice(1)
.map((line) => line.replace(' ', ''))
.join('\n')

generateTypeDef('routes.d.ts', typeDefContent)
generateTypeDefIndex()
Expand Down

0 comments on commit 2f44c51

Please sign in to comment.