Closed
Description
The [ID-prep] set of issues aligns Declaration Emit with the forthcoming Isolated Declarations feature.
🔎 Search Terms
optional parameter types not preserved
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
💻 Code
type Map = {} & { [P in string]: any }
type MapOrUndefined = Map | undefined | "dummy"
export class Foo {
constructor(
// Type node is accurate, preserve
public reuseTypeNode?: Map | undefined,
public reuseTypeNode2?: Exclude<MapOrUndefined, "dummy">,
// Resolve type node, requires adding | undefined
public resolveType?: Map,
) { }
}
export function foo1(
// Type node is accurate, preserve
reuseTypeNode: Map | undefined = {},
reuseTypeNode2: Exclude<MapOrUndefined, "dummy"> = {},
// Resolve type node, requires adding | undefined
resolveType: Map = {},
requiredParam: number) {
}
🙁 Actual behavior
Parameters and fields named reuseTypeNode*
have their types re-printed (and mangled) by the declaration transform even though the re-printed type is semantically equivalent to the source type.
🙂 Expected behavior
Parameters and fields named reuseTypeNode*
should have their types preserved as they are written in source code
Additional information about the issue
No response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment