@@ -402,6 +402,47 @@ declare module "fs" {
402402 host . checkTimeoutQueueLength ( 0 ) ;
403403 } ) ;
404404 } ) ;
405+
406+ it ( "when types in compiler option are global and installed at later point" , ( ) => {
407+ const projectRoot = "/user/username/projects/myproject" ;
408+ const app : File = {
409+ path : `${ projectRoot } /lib/app.ts` ,
410+ content : `myapp.component("hello");`
411+ } ;
412+ const tsconfig : File = {
413+ path : `${ projectRoot } /tsconfig.json` ,
414+ content : JSON . stringify ( {
415+ compilerOptions : {
416+ module : "none" ,
417+ types : [ "@myapp/ts-types" ]
418+ }
419+ } )
420+ } ;
421+ const host = createWatchedSystem ( [ app , tsconfig , libFile ] ) ;
422+ const watch = createWatchOfConfigFile ( tsconfig . path , host ) ;
423+ checkProgramActualFiles ( watch ( ) , [ app . path , libFile . path ] ) ;
424+ host . checkTimeoutQueueLength ( 0 ) ;
425+ checkOutputErrorsInitial ( host , [
426+ createCompilerDiagnostic ( Diagnostics . Cannot_find_type_definition_file_for_0 , "@myapp/ts-types" )
427+ ] ) ;
428+
429+ host . ensureFileOrFolder ( {
430+ path : `${ projectRoot } /node_modules/@myapp/ts-types/package.json` ,
431+ content : JSON . stringify ( {
432+ version : "1.65.1" ,
433+ types : "types/somefile.define.d.ts"
434+ } )
435+ } ) ;
436+ host . ensureFileOrFolder ( {
437+ path : `${ projectRoot } /node_modules/@myapp/ts-types/types/somefile.define.d.ts` ,
438+ content : `
439+ declare namespace myapp {
440+ function component(str: string): number;
441+ }`
442+ } ) ;
443+ host . checkTimeoutQueueLengthAndRun ( 1 ) ;
444+ checkOutputErrorsIncremental ( host , emptyArray ) ;
445+ } ) ;
405446 } ) ;
406447
407448 describe ( "unittests:: tsc-watch:: resolutionCache:: tsc-watch with modules linked to sibling folder" , ( ) => {
0 commit comments