- Added typesIncludesWildcard() function in moduleNameResolver.ts
- Updated all wildcard checks to use the helper function:
- checker.ts: getCannotFindNameDiagnosticForName
- programDiagnostics.ts: FileIncludeKind.AutomaticTypeDirectiveFile
- watch.ts: fileIncludeReasonToRelatedInformation
- resolutionCache.ts: updateTypeRootsWatch
- jsTyping.ts: discoverTypings
- Added imports in all consuming files
This centralizes the wildcard checking logic and makes the code more maintainable.
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
- checker.ts: Check for wildcard before choosing error message
- programDiagnostics.ts: Check for wildcard before returning early
- watch.ts: Check for wildcard to choose correct message
- jsTyping.ts: Use optional chaining for wildcard check
- tscWatch tests: Use wildcard for tests that dynamically install types
These functions should only show "add to types" messages when wildcard is NOT present.
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
- Updated getCannotFindNameDiagnosticForName to always suggest adding to types field
- Fixed FileIncludeKind.AutomaticTypeDirectiveFile messages to always show "specified in compilerOptions"
- Updated updateTypeRootsWatch to check for wildcard instead of just checking if types exists
- Updated discoverTypings to discover when types is undefined or includes wildcard
These changes ensure the new types default behavior is properly reflected in error messages and file watching.
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>