Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vocksel committed Nov 25, 2023
1 parent 711de2f commit 7fb9987
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Components/ComponentTree/Component/Directory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Props = {
local function Directory(props: Props)
local theme = useTheme()
local hover, setHover = React.useState(false)
local styles = RoactSpring.useSpring({
local styles = (RoactSpring.useSpring :: any)({
alpha = if hover then 0 else 1,
rotation = if props.expanded then 90 else 0,
config = constants.SPRING_CONFIG,
Expand Down
2 changes: 1 addition & 1 deletion src/Components/ComponentTree/Component/Story.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Props = {
local function Story(props: Props)
local theme = useTheme()
local hover, setHover = React.useState(false)
local styles = RoactSpring.useSpring({
local styles = (RoactSpring.useSpring :: any)({
alpha = if not props.active then if hover then 0 else 1 else 0,
color = if not props.active then theme.divider else theme.selection,
textColor = if not props.active then theme.textFaded else theme.background,
Expand Down
2 changes: 1 addition & 1 deletion src/Components/DragHandle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ local function DragHandle(props: Props)
local plugin = React.useContext(PluginContext.Context)
local isDragging, setIsDragging = React.useState(false)
local isHovered, setIsHovered = React.useState(false)
local mouseInput: InputObject, setMouseInput = React.useState(nil)
local mouseInput, setMouseInput = React.useState(nil :: InputObject?)

local getHandleProperties = React.useCallback(function()
local size: UDim2
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Navbar/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local function Item(props: Props)
local theme = useTheme()

local hover, setHover = React.useState(false)
local styles = RoactSpring.useSpring({
local styles = (RoactSpring.useSpring :: any)({
alpha = if not props.active and hover then 0 else 1,
config = constants.SPRING_CONFIG,
})
Expand Down
10 changes: 8 additions & 2 deletions src/Components/ResizablePanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ local function ResizablePanel(props: Props)
end, { absoluteSize })

local isWidthResizable = React.useMemo(function()
return Sift.Array.includes(props.dragHandles, "Left") or Sift.Array.includes(props.dragHandles, "Right")
if props.dragHandles then
return Sift.Array.includes(props.dragHandles, "Left") or Sift.Array.includes(props.dragHandles, "Right")
end
return nil
end, { props.dragHandles })

local isHeightResizable = React.useMemo(function()
return Sift.Array.includes(props.dragHandles, "Top") or Sift.Array.includes(props.dragHandles, "Bottom")
if props.dragHandles then
return Sift.Array.includes(props.dragHandles, "Top") or Sift.Array.includes(props.dragHandles, "Bottom")
end
return nil
end, { props.dragHandles })

local width = React.useMemo(function()
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Searchbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local function Searchbar(props: Props)
local isFocused, setIsFocused = React.useState(false)
local isExpanded = isFocused or search ~= ""

local styles = RoactSpring.useSpring({
local styles = (RoactSpring.useSpring :: any)({
alpha = if isExpanded then 1 else 0,
config = constants.SPRING_CONFIG,
})
Expand Down
2 changes: 1 addition & 1 deletion src/Components/StoryView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local function StoryView(props: Props)
local extraControls, setExtraControls = React.useState({})
local controlsHeight, setControlsHeight = React.useState(constants.CONTROLS_INITIAL_HEIGHT)
local topbarHeight, setTopbarHeight = React.useState(0)
local storyParentRef = React.useRef()
local storyParentRef = React.useRef(nil :: GuiObject?)
local controls

if story and story.controls then
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/PluginContext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local flipbook = script:FindFirstAncestor("flipbook")

local React = require(flipbook.Packages.React)

local PluginContext = React.createContext()
local PluginContext = React.createContext({})

export type Props = {
plugin: Plugin,
Expand Down

0 comments on commit 7fb9987

Please sign in to comment.