ijlee2/ember-container-query

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

NullVoxPopuli opened this issue ยท 4 comments

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

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

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.

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

success!

image