Skip to content

Instructions for using package.json with typescript (install with build) #310

@garyposter

Description

@garyposter

Is your feature request related to a problem? Please describe.
I'm successfully using netlify-lambda and netlify dev with Typescript per the README. However, when I add the simplest possible package.json (npm init and accept all defaults) in the directory with my Typescript source, the Typescript parsing fails (e.g. I get "Unexpected token" on the colon in export const handler: ProxyHandler = ...).

Describe the solution you'd like
I'd love to have README docs for how to use TypeScript (from netlify-lambda build) along with a function-local package.json (from netlify-lambda install).

Describe alternatives you've considered
This is just some nice cleanliness, I think. Putting the function dependencies in the top-level package.json shouldn't hurt anything other than clarity.

That said, it might be even nicer if the TypeScript source directory operated like the usual JS lambda folder, and let you put each function in subdirectories with their own package.json with install.

Additional context
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featurecode contributing to the implementation of a feature and/or user facing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions