Title: Declaration files error for function return types · Issue #25685 · microsoft/TypeScript · GitHub
Open Graph Title: Declaration files error for function return types · Issue #25685 · microsoft/TypeScript
X Title: Declaration files error for function return types · Issue #25685 · microsoft/TypeScript
Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Declaration files error for function return types · Issue #25685 · microsoft/TypeScript
Open Graph Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Declaration files error for function return types · Issue #25685 · microsoft/TypeScript
X Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Declaration files error for function return types · Issue #25685 · microsoft/TypeScript
Opengraph URL: https://github.com/microsoft/TypeScript
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Declaration files error for function return types","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 2.9.2\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** declaration file inline import, declaration files import path error\r\n\r\n**Code**\r\n\r\nIn *src/lib/operators/scalar.ts*\r\n```ts\r\nexport interface Scalar {\r\n\t(): string\r\n\r\n\tvalue: number\r\n\tunit: Unit\r\n\r\n\tadd(value: Scalable): this\r\n\tsubtract(value: Scalable): this\r\n\tmultiply(value: Scalable): this\r\n\tdivide(value: Scalable): this\r\n\tget(): string\r\n\ttoString(): string\r\n}\r\n\r\nexport function scalar(value: string): Scalar {\r\n\treturn parseScalar(value) // returns an object of type scalar\r\n}\r\n```\r\n\r\nIn *src/settings/spacing.ts*\r\n```ts\r\nimport { scalar } from '../lib/operators/scalar'\r\nconst baseSpacing = \"14px\"\r\n\r\nexport default {\r\n\tget xs() {\r\n\t\treturn scalar(baseSpacing).divide(4) // returns an object of type Scalar\r\n\t}\r\n})\r\n```\r\n\r\n**Expected behavior:**\r\nIn *dist/settings/spacing.d.ts*\r\n```ts\r\nimport {Scalar} from \"../lib/operators/scalar\"\r\nexport default {\r\n\treadonly xs: Scalar\r\n}\r\n```\r\n\r\n**Actual behavior:**\r\nIn *dist/settings/spacing.d.ts*\r\n```ts\r\nexport default {\r\n\treadonly xs: import(\"src/lib/operators/scalar\").Scalar\r\n}\r\n```\r\n\r\n**NOTES**:\r\n- Should it import inline? (tslint complains that it shouldn't)\r\n- The path should be \"../lib/operators/scalar\"\r\n\r\n**Local tsconfig.json**\r\n```json\r\n{\r\n\t\"extends\": \"./../../tsconfig.json\",\r\n\t\"compilerOptions\": {\r\n\t\t\"baseUrl\": \"./\",\r\n\t\t\"paths\": {\r\n\t\t\t\"*\": [\"node_modules/@types/*\", \"*\"]\r\n\t\t},\r\n\t\t\"outDir\": \"./dist\",\r\n\t\t\"rootDir\": \"./src\",\r\n\t\t\"target\": \"es5\",\r\n\t\t\"module\": \"commonjs\",\r\n\t\t\"moduleResolution\": \"node\",\r\n\t\t\"allowSyntheticDefaultImports\": true,\r\n\t\t\"allowJs\": false,\r\n\t\t\"declaration\": true,\r\n\t\t\"jsx\": \"react\",\r\n\t\t\"sourceMap\": true\r\n\t},\r\n\t\"include\": [\"./src/**/*\"],\r\n\t\"exclude\": [\r\n\t\t\"node_modules\",\r\n\t\t\"src/**/__tests__/\",\r\n\t\t\"build\",\r\n\t\t\"dist\",\r\n\t\t\"scripts\",\r\n\t\t\"acceptance-tests\",\r\n\t\t\"webpack\",\r\n\t\t\"jest\",\r\n\t\t\"src/setupTests.ts\",\r\n\t\t\"webpack.config.js\"\r\n\t]\r\n}\r\n```\r\n\r\n**Main tsconfig.json**\r\n```json\r\n{\r\n\t\"compilerOptions\": {\r\n\t\t\"baseUrl\": \"\",\r\n\t\t\"module\": \"esnext\",\r\n\t\t\"target\": \"es5\",\r\n\t\t\"lib\": [\"dom\", \"esnext\", \"es6\"],\r\n\t\t\"sourceMap\": true,\r\n\t\t\"allowJs\": true,\r\n\t\t\"jsx\": \"react\",\r\n\t\t\"moduleResolution\": \"node\",\r\n\t\t\"rootDir\": \"src\",\r\n\t\t\"forceConsistentCasingInFileNames\": true,\r\n\t\t\"noImplicitReturns\": true,\r\n\t\t\"noImplicitThis\": true,\r\n\t\t\"noImplicitAny\": false,\r\n\t\t\"strictNullChecks\": true,\r\n\t\t\"suppressImplicitAnyIndexErrors\": true,\r\n\t\t\"noUnusedLocals\": true,\r\n\t\t\"paths\": {\r\n\t\t\t\"@libs/components\": [\"Libs/Components/dist/index.js\"]\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n","author":{"url":"https://github.com/robertontiu","@type":"Person","name":"robertontiu"},"datePublished":"2018-07-16T12:39:20Z","url":"https://github.com/microsoft/TypeScript/issues/25685"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:e5c6ee6c-9834-1432-c225-f55c1994e87c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A660:213839:2D75A54:3A1DA63:6B01AE4A |
| html-safe-nonce | fec0fa773cbe43215a31e73c3f00cc044d7090f03453508bb89f8c09ffd3a61e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjYwOjIxMzgzOToyRDc1QTU0OjNBMURBNjM6NkIwMUFFNEEiLCJ2aXNpdG9yX2lkIjoiMzQxOTY3Nzg0Njg4ODU2NjUxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c195667cbadbda8df279c2bdc5b235df589c6d6f988e19a990b6b37e5d068cb4 |
| hovercard-subject-tag | repository:20929025 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/microsoft/TypeScript/issues/25685 |
| twitter:image | https://opengraph.githubassets.com/47cde802d3847ff7ce61448bd4f8c3272d012c9a3f2b9085b71a67530bf7bbd6/microsoft/TypeScript |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/47cde802d3847ff7ce61448bd4f8c3272d012c9a3f2b9085b71a67530bf7bbd6/microsoft/TypeScript |
| og:image:alt | TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Declaration files error for function return types · Issue #25685 · microsoft/TypeScript |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-cache |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width