Upon a motion to dismiss for failure to state a claim, the court may reach the merits of a properly pleaded cause of action for a declaratory judgment where no questions of fact are presented by the controversy. In that case, the motion to dismiss should be treated as one seeking a declaration in the defendant's favor and decided accordingly.
50 Clarkson Partners, LLC v Old Republic Natl. Tit. Ins. Co. NY Slip Op 04144 (2d Dep't June 29, 2022)