Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include TypeScript Declarations in JS Build #22

Open
rajsite opened this issue Jul 16, 2021 · 0 comments
Open

Include TypeScript Declarations in JS Build #22

rajsite opened this issue Jul 16, 2021 · 0 comments

Comments

@rajsite
Copy link

rajsite commented Jul 16, 2021

The JS build only emits a JS file based on the following configuration generated by the DSP:

    "js": {
      "files": [
        {
          "destination": "tokens.js",
          "format": "javascript/es6"
        }
      ],
      "transformGroup": "js",
      "buildPath": "js/"
    },

The default generation scripts should include TypeScript es6 definition files as well. It does not interfere with JS modules and improves TypeScript support:

    "js": {
      "files": [
        {
          "destination": "tokens.js",
          "format": "javascript/es6"
        },
        {
          "destination": "tokens.d.ts",
          "format": "typescript/es6-declarations"
        }
      ],
      "transformGroup": "js",
      "buildPath": "js/"
    },
rajsite added a commit to ni/nimble that referenced this issue Jul 16, 2021
# Pull Request

## 🤨 Rationale

Added a workaround that avoids forking the DSP generated config.js and enables TypeScript Type Definitions for the JS Build. Could remove after: AdobeXD/design-system-package-dsp#22

## 👩‍💻 Implementation

Specified a custom config file in the DSP configuration. The custom file loads the one generated by the design system and patches it for the TypeScript configuration changes.

I noticed that even with a custom file specified the DSP plugin will still assume the original config.js exists and will always create or update it. The extend and patch workflow in `nimble-config.js` should allow us to leverage the GUI config for the DSP to generate a `config.js` and patch it for custom behavior in `nimble-config.js`.

## 🧪 Testing

Tested with the XD extension locally.

## ✅ Checklist

- [X] I have updated the project documentation to reflect my changes. Don't think any updates needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant