Skip to content

Commit

Permalink
Accessor declared type was not visited
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomirtitian committed Mar 1, 2024
1 parent 9399b32 commit c47b97d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/compiler/transformers/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ export function transformDeclarations(context: TransformationContext) {
if (isConstTypeReference(asExpression.type) || (requiresUndefined && !canAddUndefined(type))) {
return undefined;
}
else {
else {
return visitTypeNode(type);
}
}
Expand All @@ -881,7 +881,10 @@ export function transformDeclarations(context: TransformationContext) {
function typeFromAccessor(node: AccessorDeclaration) {
const accessorDeclarations = resolver.getAllAccessorDeclarations(node);
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessorDeclarations);
return accessorType ?? inferAccessorType(accessorDeclarations.getAccessor ?? node);
if(accessorType) {
return visitTypeNode(accessorType);
}
return inferAccessorType(accessorDeclarations.getAccessor ?? node);
}
function typeFromVariable(node: VariableDeclaration) {
const declaredType = node.type;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
accessorDeclarationEmitVisibilityErrors.ts(2,18): error TS2304: Cannot find name 'DoesNotExist'.
accessorDeclarationEmitVisibilityErrors.ts(2,18): error TS4106: Parameter 'arg' of accessor has or is using private name 'DoesNotExist'.


==== accessorDeclarationEmitVisibilityErrors.ts (1 errors) ====
==== accessorDeclarationEmitVisibilityErrors.ts (2 errors) ====
export class Q {
set bet(arg: DoesNotExist) {}
~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'DoesNotExist'.
~~~~~~~~~~~~
!!! error TS4106: Parameter 'arg' of accessor has or is using private name 'DoesNotExist'.
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,3 @@ export class Q {
export class Q {
set bet(arg) { }
}


//// [accessorDeclarationEmitVisibilityErrors.d.ts]
export declare class Q {
set bet(arg: DoesNotExist);
}

0 comments on commit c47b97d

Please sign in to comment.