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

Types are not available (v4.0.0-alpha.1) #158

Closed
NullVoxPopuli opened this issue Feb 4, 2023 · 4 comments · Fixed by #157
Closed

Types are not available (v4.0.0-alpha.1) #158

NullVoxPopuli opened this issue Feb 4, 2023 · 4 comments · Fixed by #157
Labels
bug Something isn't working

Comments

@NullVoxPopuli
Copy link
Contributor

Hello! Thanks for taking time to make a bug report.

Before you make a new issue, please search for similar issues. It's possible that someone has reported this bug already.

Describe the bug 🐞

TypeScript types cannot be resolved.

Expected behavior 🤔

TypeScript types are resolved.

Minimal reproduction 🔬

import stuff from 'ember-container-query'. get error about types not being found.

Additional context ➕

At the time of reporting,

this is the package.json
{
  "name": "ember-container-query",
  "version": "4.0.0-alpha.1",
  "description": "Container queries using Ember modifiers",
  "keywords": [
    "container-queries",
    "container-query",
    "element-queries",
    "element-query",
    "ember-addon",
    "ember-octane",
    "emberjs",
    "glint",
    "responsive-design"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/ijlee2/ember-container-query.git"
  },
  "license": "MIT",
  "author": "Isaac J. Lee",
  "exports": {
    ".": "./dist/index.js",
    "./*": "./dist/*.js",
    "./addon-main.js": "./addon-main.js"
  },
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "files": [
    "addon-main.js",
    "dist"
  ],
  "scripts": {
    "build": "rollup --config",
    "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
    "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
    "lint:hbs": "ember-template-lint .",
    "lint:hbs:fix": "ember-template-lint . --fix",
    "lint:js": "eslint . --cache --ext=.js,.mjs,.ts",
    "lint:js:fix": "eslint . --ext=.js,.mjs,.ts --fix",
    "lint:types": "glint",
    "prepack": "rollup --config",
    "start": "rollup --config --watch",
    "test": "echo 'A v2 addon does not have tests, run tests in test-app'"
  },
  "dependencies": {
    "@embroider/addon-shim": "^1.8.4",
    "ember-element-helper": "^0.6.1",
    "ember-modifier": "^3.2.7",
    "ember-resize-observer-service": "^1.1.0",
    "ember-test-selectors": "^6.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.12",
    "@babel/plugin-proposal-class-properties": "^7.18.6",
    "@babel/plugin-proposal-decorators": "^7.20.7",
    "@babel/preset-typescript": "^7.18.6",
    "@embroider/addon-dev": "^3.0.0",
    "@gavant/glint-template-types": "^0.3.1",
    "@glint/core": "^v1.0.0-beta.2",
    "@glint/environment-ember-loose": "^v1.0.0-beta.2",
    "@glint/template": "^v1.0.0-beta.2",
    "@tsconfig/ember": "^2.0.0",
    "@typescript-eslint/eslint-plugin": "^5.48.2",
    "@typescript-eslint/parser": "^5.48.2",
    "ember-template-lint": "^5.3.1",
    "ember-template-lint-plugin-prettier": "^4.1.0",
    "eslint": "^8.32.0",
    "eslint-config-prettier": "^8.6.0",
    "eslint-plugin-ember": "^11.4.3",
    "eslint-plugin-n": "^15.6.1",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-simple-import-sort": "^9.0.0",
    "eslint-plugin-typescript-sort-keys": "^2.1.0",
    "prettier": "^2.8.3",
    "rollup": "^3.10.0",
    "rollup-plugin-copy": "^3.4.0",
    "rollup-plugin-ts": "^3.1.1",
    "typescript": "^4.9.4"
  },
  "engines": {
    "node": "14.* || 16.* || >= 18"
  },
  "ember": {
    "edition": "octane"
  },
  "ember-addon": {
    "app-js": {
      "./components/container-query.js": "./dist/_app_/components/container-query.js",
      "./helpers/aspect-ratio.js": "./dist/_app_/helpers/aspect-ratio.js",
      "./helpers/height.js": "./dist/_app_/helpers/height.js",
      "./helpers/width.js": "./dist/_app_/helpers/width.js",
      "./modifiers/container-query.js": "./dist/_app_/modifiers/container-query.js"
    },
    "main": "addon-main.js",
    "type": "addon",
    "version": 2
  }
}

note that there is no typeVersions object for < TS 4.7, and no exports.*.types entries for TS >= 4.7, so this is likely the problem. I will open a PR

@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Feb 4, 2023
@NullVoxPopuli
Copy link
Contributor Author

oh, it turns out typesVersions already exists on main -- just needs release

@ijlee2
Copy link
Owner

ijlee2 commented Feb 6, 2023

Ah, thanks for letting me know.

This week, I wanted to look into why the bug in #156 occurred and release a new alpha version afterwards. (Do you happen to know how styles can be defined in a v2 addon? Here's my current approach.)

If I don't get to fix the style bug, I can release a new alpha version nonetheless so that the types are available.

@ijlee2 ijlee2 linked a pull request Feb 6, 2023 that will close this issue
@ijlee2 ijlee2 changed the title Types are not available in the v4 beta Types are not available (v4.0.0-alpha.1) Feb 6, 2023
@ijlee2
Copy link
Owner

ijlee2 commented Feb 6, 2023

@NullVoxPopuli Just published v4.0.0-alpha.2. Can you try the new version?

@NullVoxPopuli
Copy link
Contributor Author

success!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants