Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Switch some type checks to external ones since they're on the public API
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoteTheMighty committed Apr 19, 2019
1 parent fd6a663 commit 4f0b3eb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/Component.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ Component.__componentName = "Component"
PureComponent.
]]
function Component:extend(name)
if config.internalTypeChecks then
internalAssert(Type.of(self) == Type.StatefulComponentClass, "Invalid use of `extend`")
end
if config.typeChecks then
assert(Type.of(self) == Type.StatefulComponentClass, "Invalid `self` argument to `extend`.")
assert(typeof(name) == "string", "Component class name must be a string")
end

Expand Down Expand Up @@ -94,8 +92,8 @@ function Component:__getDerivedState(incomingProps, incomingState)
end

function Component:setState(mapState)
if config.internalTypeChecks then
internalAssert(Type.of(self) == Type.StatefulComponentInstance, "Invalid use of `setState`")
if config.typeChecks then
assert(Type.of(self) == Type.StatefulComponentInstance, "Invalid `self` argument to `extend`.")
end

local internalData = self[InternalData]
Expand Down

0 comments on commit 4f0b3eb

Please sign in to comment.