Can't make folder/Can't make alias error

I have a script that gets the items of a folder, then if those items are folders, it processes 1 subroutine, and if those items are files, it processes a different subroutine. I keep getting a Can’t Make error on the line that says “if folder of the item_info is true then”

I have tried using the alias reference with that line, but it just says can’t make alias of item_info. I am obviously confused again…can anyone advise me? Thanks!

set myFolder to ((path to home folder as Unicode text) & "Fav:" as string) as alias
tell application "Finder"
	set these_items to folders of myFolder
	
	repeat with i from 1 to the count of these_items
		set this_item to (item i of myFolder)
		set the item_info to (info for this_item as alias)
		checkStableSize(this_item as alias) of me
		if folder of the item_info is true then
			process_folder(this_item) of me
		else if (alias of the item_info is false) and ¬
			((the file type of the item_info is in the type_list) or ¬
				the name extension of the item_info is in the extension_list) then
			process_item(this_item) of me
		end if
		
	end repeat
end tell

Something like this works for me (don’t know why getting folder of info for doesn’t seem to work)

set myFolder to (path to pictures folder as Unicode text) as alias
set WhatIsIt to {}
tell application "Finder"
	set allI to items of myFolder as alias list
	repeat with anItem in allI
		if last character of (anItem as text) is ":" then
			set end of WhatIsIt to "Folder"
		else
			set end of WhatIsIt to "File"
		end if
	end repeat
end tell

You can also do it this way:

set myFolder to (path to pictures folder as Unicode text) as alias
set WhatIsIt to {}
tell application "Finder"
	set allI to items of myFolder as alias list
	repeat with anItem in allI
		if (anItem as text) ends with ":" then
			set end of WhatIsIt to "Folder"
		else
			set end of WhatIsIt to "File"
		end if
	end repeat
end tell

You need to parenthesise the coercion to make sure that ‘info for’ is applied to the result rather than to the Finder reference:

set the item_info to (info for (this_item as alias))

Another problem with your script is that the repeat loop counter is based on the number of folders in myFolder, but the items being indexed are myFolder’s ‘items’, which might be either files or folders.

set myFolder to ((path to home folder as Unicode text) & "Fav:") as alias
tell application "Finder"
	try
		set these_items to (items of myFolder) as alias list
	on error
		set this_items to {(item 1 of my folder) as alias}
	end try
end tell
repeat with this_item in these_items
	checkStableSize(this_item) 
	tell (info for this_item)
		if (folder) and not (package folder) then
			my process_folder(this_item)
		else if not (its alias) and ((file type is in type_list) or (name extension is in extension_list)) then
			my process_item(this_item)
		end if
	end tell
end repeat