diff --git a/src/fast_check/transform.rs b/src/fast_check/transform.rs index 31b19a83a..8a6a08746 100644 --- a/src/fast_check/transform.rs +++ b/src/fast_check/transform.rs @@ -456,7 +456,7 @@ impl<'a> FastCheckTransformer<'a> { )?; Ok(true) } - Decl::Var(n) => self.transform_var(n, is_ambient), + Decl::Var(n) => self.transform_var(n, is_ambient || n.declare), Decl::TsInterface(_) => Ok(self.public_ranges.contains(&public_range)), Decl::TsTypeAlias(_) => Ok(self.public_ranges.contains(&public_range)), Decl::TsEnum(_) => Ok(self.public_ranges.contains(&public_range)), @@ -1262,7 +1262,7 @@ impl<'a> FastCheckTransformer<'a> { ) -> Result> { n.decls.retain(|n| self.public_ranges.contains(&n.range())); - // don't need to do anything for these in a declaration file + // don't need to do anything for ambient decls if !is_ambient { for decl in &mut n.decls { self.transform_var_declarator(decl)?; diff --git a/tests/specs/graph/fast_check/var_declare_keyword.txt b/tests/specs/graph/fast_check/var_declare_keyword.txt new file mode 100644 index 000000000..6a5ac9cde --- /dev/null +++ b/tests/specs/graph/fast_check/var_declare_keyword.txt @@ -0,0 +1,70 @@ +# https://jsr.io/@scope/a/meta.json +{"versions": { "1.0.0": {} } } + +# https://jsr.io/@scope/a/1.0.0_meta.json +{ "exports": { ".": "./mod.ts" } } + +# https://jsr.io/@scope/a/1.0.0/mod.ts +declare const existsNominal: unique symbol; + +export type Exists = F & { [existsNominal]: never }; + +# mod.ts +import 'jsr:@scope/a' + +# output +{ + "roots": [ + "file:///mod.ts" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "jsr:@scope/a", + "code": { + "specifier": "jsr:@scope/a", + "span": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 21 + } + } + } + } + ], + "size": 22, + "mediaType": "TypeScript", + "specifier": "file:///mod.ts" + }, + { + "kind": "esm", + "size": 101, + "mediaType": "TypeScript", + "specifier": "https://jsr.io/@scope/a/1.0.0/mod.ts" + } + ], + "redirects": { + "jsr:@scope/a": "https://jsr.io/@scope/a/1.0.0/mod.ts" + }, + "packages": { + "@scope/a": "@scope/a@1.0.0" + } +} + +Fast check https://jsr.io/@scope/a/1.0.0/mod.ts: + {} + declare const existsNominal: unique symbol; + export type Exists = F & { + [existsNominal]: never; + }; + --- DTS --- + declare const existsNominal: unique symbol; + export type Exists = F & { + [existsNominal]: never; + };