Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6290

"void promiseExpression" in TypeScript

$
0
0

Looking at a React Native app in TypeScript, and there is this fragment in a screen file:

export const DetailPageScreen: FC<StackScreenProps<AuthorizedNavigatorParamList, 'Details'>> = observer(({ route, navigation }) => {  useEffect(() => {    void (async () => {      await SomeFunction();    })();  }, []);

Help me parse what goes into useEffect. It's a function with a body that goes:

() =>{    void (async () => {      await SomeFunction();    })();}

So what's inside the parentheses after void is an async function invocation without an await - an expression that results in a promise, I presume. So what is void doing here, exactly? It boils down to void promiseObject, if I followed this right.


Viewing all articles
Browse latest Browse all 6290

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>