syrokos
03/16/2022, 12:45 AMAngius
03/16/2022, 12:46 AMAngius
03/16/2022, 12:46 AMErwin
03/16/2022, 12:58 AMAngius
03/16/2022, 12:58 AMBytesource
03/16/2022, 9:22 AMts
files?Isaac McFadyen | YYZ01
03/16/2022, 12:13 PM.ts
files because by the time the import happens it's already a .js
file. The only reason you can sometimes is because your bundler takes care of transforming it (Webpack or esbuild
etc)Bytesource
03/16/2022, 1:15 PM.ts
file present because importing other .ts
files is not possible?
I tried importing a .ts
file as .js
into the main Typescript file, but this resulted in the same could not resolve… error.
Is there a way to use Typescript natively (so to speak) with Cloudflare Pages?Isaac McFadyen | YYZ01
03/16/2022, 1:15 PMesbuild
under the hood to bundle your functions, so .ts
imports should absolutely work...Isaac McFadyen | YYZ01
03/16/2022, 1:16 PMdsincl12
03/16/2022, 1:50 PMIsaac McFadyen | YYZ01
03/16/2022, 1:59 PMHelpflare
03/16/2022, 1:59 PM@sveltejs/adapter-static
and normal Functions.dsincl12
03/16/2022, 1:59 PMdsincl12
03/16/2022, 3:17 PMIsaac McFadyen | YYZ01
03/16/2022, 3:20 PMIsaac McFadyen | YYZ01
03/16/2022, 3:20 PMdsincl12
03/16/2022, 3:29 PMdsincl12
03/16/2022, 3:47 PMIsaac McFadyen | YYZ01
03/16/2022, 4:07 PMdsincl12
03/16/2022, 4:56 PMexport async function post({ request, platform }) {
const data = await request.formData();
const SENDGRID_API_KEY = platform.env.SENDGRID_API_KEY;
...
can't understand why this value doesn't seem to exist 😦 is there something wrong in app.dt.ts?
declare namespace App {
// interface Locals {}
interface Platform {
env: {
SENDGRID_API_KEY: SENDGRID_API_KEY
}
}
// interface Session {}
// interface Stuff {}
}
Isaac McFadyen | YYZ01
03/16/2022, 4:56 PMsvelte-kit dev
unfortunately it doesn't have it.Isaac McFadyen | YYZ01
03/16/2022, 4:56 PMsvelte-kit build
and then svelte-kit preview
Isaac McFadyen | YYZ01
03/16/2022, 4:57 PMnpm run build
and npm run preview
I think)dsincl12
03/16/2022, 4:57 PMdsincl12
03/16/2022, 4:57 PMIsaac McFadyen | YYZ01
03/16/2022, 4:59 PMIsaac McFadyen | YYZ01
03/16/2022, 5:00 PMstring
since that type is just the type.Isaac McFadyen | YYZ01
03/16/2022, 5:00 PMinterface Platform {
env: {
SENDGRID_API_KEY: string
}
}
dsincl12
03/16/2022, 5:00 PM${SENDGRID_API_KEY}
would work?