I've encountered a peculiar issue with Module augmentation. I currently have an agument.d.ts
file located in my src
folder at <ROOT>/src/augment.d.ts
. Within this file, I am defining a module for Webpack's raw-loader
and extending the existing hapi
module. The code snippet is as follows:
import { Server } from 'hapi';
declare module '*.view.html' {
const contents: string;
export default contents;
}
declare module 'hapi' {
interface Server {
x: string;
}
}
In my tsconfig.json
configuration, I'm utilizing the default settings for typeRoots
. Additionally, the include
parameter is set to ["src/**/*.ts"]
.
The issue arises when attempting to augment the hapi
module works fine, but the process fails for *.view.html
; The compiler consistently throws errors for all imports related to html
files.
What's intriguing is that when I relocate the definition for *.view.html
to another file such as - xyz.html.d.ts
, everything functions perfectly.
Is this behavior intended? Is there a restriction on having only one module augmentation per declaration file? Are there any unspoken rules that I might be overlooking?