Skip to content

Commit 1e3ce0a

Browse files
committed
fix(rbs): update type signatures for Phlex 2, new classes, and refactored methods
The RBS runtime type checker was failing because signatures were stale after the Phlex 2 upgrade and code refactoring. Key changes: - Fix view_template block arity: (untyped) -> () for Phlex 2 yield pattern - Add signatures for Attributes module, ActionsButtons, and ErrorPage - Update BasicLayout/BasicComponent to include Attributes module - Add authorize! to Router, @loaded to Settings - Remove stale actions_buttons from Index/Show (now a component)
1 parent e14f622 commit 1e3ce0a

16 files changed

Lines changed: 48 additions & 25 deletions

sig/tiny_admin/router.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ module TinyAdmin
66

77
def authorization: () -> untyped
88

9+
def authorize!: (Symbol, ?String?) { () -> void } -> void
10+
911
def render_page: (untyped) -> void
1012

1113
def root_route: (untyped) -> void

sig/tiny_admin/settings.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ module TinyAdmin
44
OPTIONS: Array[Symbol]
55

66
@options: Hash[Array[Symbol], untyped]
7+
@loaded: bool
78

8-
attr_reader store: Store
9+
attr_reader store: Store?
910

1011
# Dynamically defined accessors for OPTIONS
1112
def authentication: () -> untyped

sig/tiny_admin/views/actions/index.rbs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ module TinyAdmin
1111
attr_accessor records: Enumerable[untyped]
1212
attr_accessor slug: String
1313

14-
def view_template: () ?{ (untyped) -> void } -> void
14+
def view_template: () ?{ () -> void } -> void
1515

1616
private
1717

18-
def actions_buttons: () -> void
19-
2018
def table_body: () -> void
2119

2220
def table_header: () -> void

sig/tiny_admin/views/actions/show.rbs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ module TinyAdmin
99
attr_accessor reference: untyped
1010
attr_accessor slug: String
1111

12-
def view_template: () ?{ (untyped) -> void } -> void
13-
14-
private
15-
16-
def actions_buttons: () -> void
12+
def view_template: () ?{ () -> void } -> void
1713
end
1814
end
1915
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module TinyAdmin
2+
module Views
3+
module Attributes
4+
def update_attributes: (Hash[Symbol, untyped]) -> void
5+
end
6+
end
7+
end
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
module TinyAdmin
22
module Views
33
class BasicLayout
4+
include Attributes
45
include Utils
56

67
attr_accessor content: untyped
78
attr_accessor params: untyped
89
attr_accessor widgets: untyped
910

1011
def label_for: (String, options: Array[untyped]) -> String?
11-
12-
def update_attributes: (Hash[Symbol, untyped]) -> void
1312
end
1413
end
1514
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module TinyAdmin
2+
module Views
3+
module Components
4+
class ActionsButtons < BasicComponent
5+
attr_accessor actions: Hash[String, untyped]?
6+
attr_accessor slug: String?
7+
attr_accessor reference: untyped
8+
9+
def view_template: () -> void
10+
end
11+
end
12+
end
13+
end

sig/tiny_admin/views/components/basic_component.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module TinyAdmin
22
module Views
33
module Components
44
class BasicComponent
5-
def update_attributes: (Hash[Symbol, untyped]) -> void
5+
include Attributes
66
end
77
end
88
end

sig/tiny_admin/views/default_layout.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module TinyAdmin
88
attr_accessor options: Array[Symbol]?
99
attr_accessor title: String?
1010

11-
def view_template: () ?{ (untyped) -> void } -> void
11+
def view_template: () ?{ () -> void } -> void
1212

1313
private
1414

sig/tiny_admin/views/pages/content.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module TinyAdmin
22
module Views
33
module Pages
44
class Content < DefaultLayout
5-
def view_template: () ?{ () -> void } -> void
5+
def view_template: () -> void
66
end
77
end
88
end

0 commit comments

Comments
 (0)