Repository navigation
NodeJS SDK - Export Container type - #5141
Merged
Merged
Conversation
crjm
reviewed
May 16, 2023
Contributor
There was a problem hiding this comment.
I'm not able to avoid VSCode from complaining when importing the Container type in the pipeline.
This is the pipeline:
import Client, { connect, Container } from "@dagger.io/dagger"
// create Dagger client
connect(async (client: Client) => {
// setup container and
// define environment variables
const ctr = client
.container()
.from("alpine")
.with(envVariables({
ENV_VAR_1: "VALUE 1",
ENV_VAR_2: "VALUE 2",
ENV_VAR_3: "VALUE 3",
}))
.withExec(["env"])
// print environment variables
console.log(await ctr.stdout())
}, { LogOutput: process.stderr })
function envVariables(envs: Record<string, string>) {
return (c: Container): Container => {
Object.entries(envs).forEach(([key, value]) => {
c = c.withEnvVariable(key, value)
})
return c
}
}This is my dagger/sdk/nodejs/dist/index.ts
import Client, { Container } from "./api/client.gen.js"
export { gql } from "graphql-tag"
export { GraphQLClient } from "graphql-request"
export { connect, ConnectOpts, CallbackFct } from "./connect.js"
export default Client
export { Container }I get Module '"@dagger.io/dagger"' has no exported member 'Container'. Did you mean to use 'import Container from "@dagger.io/dagger"' instead?
Things I tried:
- Unlinked the
@dagger.io/daggerrepo, and relinked it. - Removed the
node_modulesfolder, linked the@dagger.io/daggerpackage again. - Reloaded the TS server.
- Reloaded the window.
The pipeline runs ok, but I don't know why TS static checking is not happy.
helderco
reviewed
May 16, 2023
slumbering
force-pushed
the
sdk-nodejs-export-type
branch
2 times, most recently
from
May 17, 2023 09:23
bc21886 to
aa414a7
Compare
Contributor
Author
|
Pushing a fix for tests now |
Contributor
|
I just pushed a fix that updates the imports in
As discussed with @grouville, I pushed the commit so we can unblock PR #5139 |
Signed-off-by: jffarge <[email protected]>
Signed-off-by: jffarge <[email protected]>
Signed-off-by: jffarge <[email protected]>
Signed-off-by: Julián Cruciani <[email protected]>
grouville
force-pushed
the
sdk-nodejs-export-type
branch
from
May 17, 2023 18:28
7b281db to
01fee00
Compare
grouville
approved these changes
May 17, 2023
grouville
left a comment
Member
There was a problem hiding this comment.
Works perfectly, thanks for this add-on 🙏 ✅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

To properly use typescript with the Node.js SDK, it should export more types.
In order to fix the cookbook PR #5139, this PR will only cover
Containertype.Additional PRs will be developed subsequently to accommodate other types.