fix(check): regression where config "types" entries caused type checking errors (#18124)

Closes #18117
Closes #18121 (this is just over 10ms faster in a directory one up from
the root folder)

cc @nayeemrmn
This commit is contained in:
David Sherret 2023-03-11 11:43:45 -05:00 committed by GitHub
parent e4430400ce
commit 8db853514c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 170 additions and 174 deletions

View file

@ -818,7 +818,7 @@ pub struct Documents {
resolver_config_hash: u64,
/// Any imports to the context supplied by configuration files. This is like
/// the imports into the a module graph in CLI.
imports: Arc<HashMap<ModuleSpecifier, GraphImport>>,
imports: Arc<IndexMap<ModuleSpecifier, GraphImport>>,
/// A resolver that takes into account currently loaded import map and JSX
/// settings.
resolver: CliGraphResolver,
@ -851,6 +851,14 @@ impl Documents {
}
}
pub fn module_graph_imports(&self) -> impl Iterator<Item = &ModuleSpecifier> {
self
.imports
.values()
.flat_map(|i| i.dependencies.values())
.flat_map(|value| value.get_type().or_else(|| value.get_code()))
}
/// "Open" a document from the perspective of the editor, meaning that
/// requests for information from the document will come from the in-memory
/// representation received from the language server client, versus reading
@ -946,7 +954,6 @@ impl Documents {
/// Return `true` if the specifier can be resolved to a document.
pub fn exists(&self, specifier: &ModuleSpecifier) -> bool {
// keep this fast because it's used by op_exists, which is a hot path in tsc
let specifier = self.specifier_resolver.resolve(specifier);
if let Some(specifier) = specifier {
if self.open_docs.contains_key(&specifier) {
@ -1239,7 +1246,7 @@ impl Documents {
})
.collect()
} else {
HashMap::new()
IndexMap::new()
},
);