Working with files is one of the tricky points with Dynamics 365 Business Central. While in the on-premises version you have full access to your local resources and a filesystem, in the SaaS version of Dynamics 365 Business Central, things are different. Here, you don't have a filesystem and you don't have access to local resources (all processes runs in Microsoft's data centers).
If you create a function, you declare a File variable and then you invoke one of the common file management methods (such as Create, which creates and opens an ASCII or binary file), and this is the error that Visual Studio Code spits out:
This error occurs because the extension you're trying to create targets the Dynamics 365 Business Central SaaS environment by default ("target": "Extension" in the app.json file...