@quenty/propertyvalue 7.17.3 → 7.17.4-canary.11a5dcf.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.17.4-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/propertyvalue@7.17.3...@quenty/propertyvalue@7.17.4-canary.11a5dcf.0) (2025-05-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Additional type checking updates ([05ba29a](https://github.com/Quenty/NevermoreEngine/commit/05ba29a03efc9f3feed74b34f1d9dfb237496214))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [7.17.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/propertyvalue@7.17.2...@quenty/propertyvalue@7.17.3) (2025-04-10)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/propertyvalue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/propertyvalue",
3
- "version": "7.17.3",
3
+ "version": "7.17.4-canary.11a5dcf.0",
4
4
  "description": "Property value for Roblox instances",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,11 +25,11 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/instanceutils": "^13.17.3",
29
- "@quenty/loader": "^10.8.3"
28
+ "@quenty/instanceutils": "13.17.4-canary.11a5dcf.0",
29
+ "@quenty/loader": "10.8.4-canary.11a5dcf.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "b06c070ae91d5dab7bd8de6e290ad2caabb15d8f"
34
+ "gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
35
35
  }
@@ -1,3 +1,4 @@
1
+ --!strict
1
2
  --[=[
2
3
  Proxies a property in Roblox
3
4
 
@@ -6,14 +7,47 @@
6
7
 
7
8
  local require = require(script.Parent.loader).load(script)
8
9
 
10
+ local Brio = require("Brio")
11
+ local Observable = require("Observable")
12
+ local Rx = require("Rx")
9
13
  local RxInstanceUtils = require("RxInstanceUtils")
10
- local _Observable = require("Observable")
11
14
 
12
15
  local PropertyValue = {}
13
16
  PropertyValue.ClassName = "PropertyValue"
14
17
  PropertyValue.__index = PropertyValue
15
18
 
16
- function PropertyValue.new(instance: Instance, propertyName: string)
19
+ export type PropertyValue<T> = typeof(setmetatable(
20
+ {} :: {
21
+ --[=[
22
+ The value of the property
23
+
24
+ @prop Value T
25
+ @within PropertyValue
26
+ ]=]
27
+ Value: T,
28
+
29
+ --[=[
30
+ The signal that fires when the property changes
31
+
32
+ @prop Changed RBXScriptSignal
33
+ @within PropertyValue
34
+ ]=]
35
+ Changed: RBXScriptSignal<T>,
36
+
37
+ _obj: Instance,
38
+ _propertyName: string,
39
+ },
40
+ {} :: typeof({ __index = PropertyValue })
41
+ ))
42
+
43
+ --[=[
44
+ Creates a new PropertyValue
45
+
46
+ @param instance Instance
47
+ @param propertyName string
48
+ @return PropertyValue
49
+ ]=]
50
+ function PropertyValue.new<T>(instance: Instance, propertyName: string): PropertyValue<T>
17
51
  assert(typeof(instance) == "Instance", "Bad argument 'instance'")
18
52
  assert(type(propertyName) == "string", "Bad argument 'propertyName'")
19
53
 
@@ -22,20 +56,33 @@ function PropertyValue.new(instance: Instance, propertyName: string)
22
56
  self._obj = instance
23
57
  self._propertyName = propertyName
24
58
 
25
- return setmetatable(self, PropertyValue)
59
+ return setmetatable(self :: any, PropertyValue)
26
60
  end
27
61
 
28
- function PropertyValue:ObserveBrio(condition)
62
+ --[=[
63
+ Observes the property of the object.
64
+
65
+ @return Observable<Brio<T>>
66
+ ]=]
67
+ function PropertyValue.ObserveBrio<T>(
68
+ self: PropertyValue<T>,
69
+ condition: Rx.Predicate<T>?
70
+ ): Observable.Observable<Brio.Brio<T>>
29
71
  return RxInstanceUtils.observePropertyBrio(self._obj, self._propertyName, condition)
30
72
  end
31
73
 
32
- function PropertyValue:Observe(): _Observable.Observable<unknown>
74
+ --[=[
75
+ Observes the property of the object.
76
+
77
+ @return Observable<any>
78
+ ]=]
79
+ function PropertyValue.Observe<T>(self: PropertyValue<T>): Observable.Observable<any>
33
80
  return RxInstanceUtils.observeProperty(self._obj, self._propertyName)
34
81
  end
35
82
 
36
- function PropertyValue:__index(index)
83
+ (PropertyValue :: any).__index = function<T>(self: PropertyValue<T>, index)
37
84
  if index == "Value" then
38
- return self._obj[self._propertyName]
85
+ return (self._obj :: any)[self._propertyName]
39
86
  elseif index == "Changed" then
40
87
  return self._obj:GetPropertyChangedSignal(self._propertyName)
41
88
  elseif PropertyValue[index] or index == "_obj" then
@@ -45,9 +92,11 @@ function PropertyValue:__index(index)
45
92
  end
46
93
  end
47
94
 
48
- function PropertyValue:__newindex(index, value)
95
+ function PropertyValue.__newindex<T>(self: PropertyValue<T>, index, value)
49
96
  if index == "Value" then
50
- self._obj[self._propertyName] = value
97
+ (self._obj :: any)[self._propertyName] = value
98
+ elseif PropertyValue[index] then
99
+ error(string.format("%q is not writable", tostring(index)))
51
100
  else
52
101
  error(string.format("%q is not a member of PropertyValue", tostring(index)))
53
102
  end