Skip to content

Commit f40764b

Browse files
general improvements, added childrenof and descendantsof type functions
1 parent 83fc4d3 commit f40764b

File tree

8 files changed

+417
-30
lines changed

8 files changed

+417
-30
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
run: |
101101
export PATH="$HOME/.rokit/bin:$PATH"
102102
rokit trust UpliftGames/wally
103+
rokit trust rojo-rbx/rojo
103104
rokit install
104105
105106
- name: Rokit Cache Save

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
/*.rbxlx.lock
66
/*.rbxl.lock
77

8+
sourcemap.json
9+
810
# MacOS file system clutter.
911
._*
1012
.DS_STORE

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v0.0.2
2+
# Features
3+
- Added `ChildrenOf` and `DescendantsOf` type functions.
4+
15
# v0.0.1
26
# Features
37
- Initital release.

README.md

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
# Typebrick
22
A Type Function utility library for Roblox.
33

4+
wally: https://wally.run/package/cameronpcampbell/typebrick
5+
46
> [!TIP]
57
> Check out [Typeforge](https://github.com/typeforge-luau/typeforge), a type function utility library for Luau.
68
7-
wally: https://wally.run/package/cameronpcampbell/typebrick
8-
99
## Docs
1010

1111
### PropertiesOf(input: type) -> type
1212
Returns a table of properties for the given Roblox instance.
1313

1414
```luau
15-
type Props = PropertiesOf<Part>
15+
type Result = PropertiesOf<Part>
16+
1617
--[[
17-
{
18+
type Result = {
1819
Anchored: boolean,
1920
... *TRUNCATED*
2021
]]
@@ -24,9 +25,10 @@ type Props = PropertiesOf<Part>
2425
Returns a table of methods for the given Roblox instance.
2526

2627
```luau
27-
type Methods = MethodsOf<Part>
28+
type Result = MethodsOf<Part>
29+
2830
--[[
29-
{
31+
type Result = {
3032
AddTag: (Instance, string) -> nil,
3133
... *TRUNCATED*
3234
]]
@@ -36,9 +38,10 @@ type Methods = MethodsOf<Part>
3638
Returns a table of events for the given Roblox instance.
3739

3840
```luau
39-
type Events = EventsOf<Part>
41+
type Result = EventsOf<Part>
42+
4043
--[[
41-
{
44+
type Result = {
4245
AncestryChanged: {
4346
Connect: t1,
4447
ConnectParallel: (t2, (Instance, Instance?) -> ()) -> RBXScriptConnection,
@@ -47,4 +50,33 @@ type Events = EventsOf<Part>
4750
},
4851
... *TRUNCATED*
4952
]]
53+
```
54+
55+
### ChildrenOf(input: type) -> type
56+
Returns a table of children for the given Roblox instance.
57+
58+
```luau
59+
type Result = ChildrenOf<typeof(workspace.Part)>
60+
61+
--[[
62+
type Result = {
63+
1: Attachment
64+
}
65+
]]
66+
```
67+
68+
### DescendantsOf(input: type) -> type
69+
Returns a table of children for the given Roblox instance.
70+
71+
```luau
72+
type Result = DescendantsOf<typeof(workspace)>
73+
74+
--[[
75+
type Result = {
76+
1: Part,
77+
2: Camera,
78+
3: Terrain,
79+
4: Attachment
80+
}
81+
]]
5082
```

rokit.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55

66
[tools]
77
wally = "UpliftGames/wally@0.3.2"
8+
rojo = "rojo-rbx/rojo@7.6.1"

0 commit comments

Comments
 (0)