To restrict the scope of variables to the function which it requires, we use typeset without any options, here is the example how to use the typeset without any functions to achieve the desired result in complex and large programs.
#!/bin/ksh/
x=1
y=2
function myfun {
x=3
typeset y=4
print "Inside function x is $x"
print "Inside function y is $y"
}
myfun
print "Outside function x is $x"
print "Outside function y is $y"
exit 0