-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
TypeScript declaration error: a type annotation is necessary #1031
Comments
This is a very common error in TS I have encountered many times but the circumstances are quite hard to pinpoint. See microsoft/TypeScript#42873 Does adding |
@ssalbdivad Hello, yes adding Error:
Reproduction: import * as ark from 'arktype'
export const Foo = ark.type(/\d+_\d+/).pipe((s) => {
const split = s.split('_')
const fst = split[0]
const snd = split[1]
if (fst === undefined || snd === undefined) {
return `Received unexpectedly invalid string ${split}, expected a string matching the pattern /\\d+_\\d/`
}
return Number(`${fst}${snd}`)
}, ark.type('integer')) I believe the issue comes from Just for reference, I'm taking a string like this: |
Hmm, well that is unfortunate and also very environment-dependent. I would consider bundling As a potential stopgap, I will also try re-exporting inferred symbols from |
Thank you for your help! |
FWIW we switched from pnpm to yarn 4 and the issue is still happening. However, the initial issue that I opened with (i.e. |
Closing this for now, but will continue to track additional remediation for this as part of #1049 |
Another possible solution for this issue is adding {
"compilerOptions": {
// ...
"types": [
"@ark/schema"
]
}
} |
confirmed working on my workspace, without needing to install the EDIT The dependencies resolution is broken again on |
Report a bug
Hello, I have an issue while exporting arktype schemas using TypeScript. I get the following error:
🔎 Search Terms
cannot be named, without reference to, likely not portable, type annotation necessary, declaration files
🧩 Context
declaration: true
in tsconfig🧑💻 Repro
The above will result in the error found at the top of this issue. Note: TS must be configured to emit declaration files in order to see the error
The text was updated successfully, but these errors were encountered: