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 4f63418
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/compiler/transformers/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 4f63418

Please sign in to comment.