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

FormData .get() does not exist? [closed]

$
0
0

I'm admittedly fairly new to typescript and have followed a few tutorials to get an OAuth flow setup which works just fine but the typescript compiler keeps giving me the error: Property 'get' does not exist on type 'FormData'. ts(2339) .

I've googled and read a bunch about why this happens but the solution is always to update typescript or the libraries in the tsconfig.json (which I believe I've done). I'll post some code snippets and the config below. Has anyone else had this issue and if so what's the standard or accepted update for it?

This is one of the points that errors:

export async function POST(request: Request) {  ....   const formData = await request.formData();  platform = (formData.get("platform") as string) || "native";  ....

tsconfig.json - a lot of the changes in here have been to fix this issue so there may be some issues, feel free to let me know about them as well :D

{"extends": "expo/tsconfig.base","compilerOptions": {"strict": true,"skipLibCheck": true,"baseUrl": "./","paths": {"@/*": ["./*"],"@hooks/*": ["hooks/*"],"@utils/*": ["utils/*"],"@constants/*": ["constants/*"]    },"lib": ["dom", "dom.iterable", "es6", "ES2015.Iterable"],"downlevelIteration": true,"target": "es6","module": "esnext"  },"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"],"exclude": ["node_modules"]} 

One of the suggestions I've seen many times is to do something like this

declare global {  interface FormData {    entries(): Iterator<[USVString, USVString | Blob]>;  }}

but for the get() method. I'm not sure if this is the correct way to handle this as everything I've read says that the get() method should be standard with the FormData object. I'll try the above to see if it works but would prefer to find the actual cause of this issue.

Thanks for any help you can provide!


Viewing all articles
Browse latest Browse all 6581

Latest Images

Trending Articles



Latest Images