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

[QUEST] Future Public TypeScript Types #19946

Closed
Tracked by #20162
wagenet opened this issue Feb 7, 2022 · 4 comments · Fixed by #20449
Closed
Tracked by #20162

[QUEST] Future Public TypeScript Types #19946

wagenet opened this issue Feb 7, 2022 · 4 comments · Fixed by #20449

Comments

@wagenet
Copy link
Member

wagenet commented Feb 7, 2022

The plan is eventually for Ember to export all of its own TypeScript types. In preparation for this, we'd like to have the internal Ember modules export the correct types.

RFC 0176 Types

These are the full set of APIs Ember has exposed, per the officially maintained data. This may include items that have been deprecated or removed!

Detailed Status breakdown

Unchecked items are one of the following:

  • Unimplemented
  • Untested
  • Things we don't want to export

@ember/application

  • import Application from '@ember/application': - Ember.Application
  • import { getOwner } from '@ember/application'; - Ember.getOwner
  • import { onLoad } from '@ember/application'; - Ember.onLoad
  • import { runLoadHooks } from '@ember/application'; - Ember.runLoadHooks
  • import { setOwner } from '@ember/application'; - Ember.setOwner
  • import GlobalsResolver from '@ember/application/globals-resolver'; - Ember.DefaultResolver
  • import ApplicationInstance from '@ember/application/instance'; - Ember.ApplicationInstance
  • import Namespace from '@ember/application/namespace'; - Ember.Namespace
  • import Resolver from '@ember/application/resolver'; - Ember.Resolver

@ember/array

  • import EmberArray from '@ember/array'; - Ember.Array
  • import { A } from '@ember/array'; - Ember.A
  • import { isArray } from '@ember/array'; - Ember.isArray
  • import { makeArray } from '@ember/array'; - Ember.makeArray
  • import MutableArray from '@ember/array/mutable'; - Ember.MutableArray
  • import ArrayProxy from '@ember/array/proxy'; - Ember.ArrayProxy

@ember/canary-features (PR: #19947)

  • import { FEATURES } from '@ember/canary-features'; - Ember.FEATURES
  • import { isEnabled } from '@ember/canary-features'; - Ember.FEATURES.isEnabled

@ember/component (PR: #19948)

  • import Component from '@ember/component'; - Ember.Component
  • import { Input } from '@ember/component'; - Ember._Input
  • import { Textarea } from '@ember/component'; - Ember._TextArea
  • import { capabilities } from '@ember/component'; - Ember._componentManagerCapabilities
  • UNTESTED import { getComponentTemplate } from '@ember/component'; - Ember._getComponentTemplate
  • UNTESTED import { setComponentManager } from '@ember/component'; - Ember._setComponentManager
  • import { setComponentTemplate } from '@ember/component'; - Ember._setComponentTemplate
  • import Checkbox from '@ember/component/checkbox'; - Ember.Checkbox
  • import Helper from '@ember/component/helper'; - Ember.Helper
  • import { helper as buildHelper } from '@ember/component/helper'; - Ember.Helper.helper
  • import templateOnlyComponent from '@ember/component/template-only'; - Ember._templateOnlyComponent
  • import TextArea from '@ember/component/text-area'; - Ember.TextArea
  • import TextField from '@ember/component/text-field'; - Ember.TextField

@ember/controller

  • import Controller from '@ember/controller'; - Ember.Controller
  • import { inject } from '@ember/controller'; - Ember.inject.controller

@ember/debug (PR: #19947)

  • import { assert } from '@ember/debug'; - Ember.assert
  • import { debug } from '@ember/debug'; - Ember.debug
  • import { inspect } from '@ember/debug'; - Ember.inspect
  • import { registerDeprecationHandler } from '@ember/debug'; - Ember.Debug.registerDeprecationHandler
  • import { registerWarnHandler } from '@ember/debug'; - Ember.Debug.registerWarnHandler
  • import { runInDebug } from '@ember/debug'; - Ember.runInDebug
  • import { warn } from '@ember/debug'; - Ember.warn
  • import ContainerDebugAdapter from '@ember/debug/container-debug-adapter'; - Ember.ContainerDebugAdapter
  • import DataAdapter from '@ember/debug/data-adapter'; - Ember.DataAdapter

@ember/destroyable (PR: #19947)

  • import { assertDestroyablesDestroyed } from '@ember/destroyable'; - Ember._assertDestroyablesDestroyed
  • import { associateDestroyableChild } from '@ember/destroyable'; - Ember._associateDestroyableChild
  • import { destroy } from '@ember/destroyable'; - Ember.destroy
  • import { enableDestroyableTracking } from '@ember/destroyable'; - Ember._enableDestroyableTracking
  • import { isDestroyed } from '@ember/destroyable'; - Ember._isDestroyed
  • import { isDestroying } from '@ember/destroyable'; - Ember._isDestroying
  • import { registerDestructor } from '@ember/destroyable'; - Ember._registerDestructor
  • import { unregisterDestructor } from '@ember/destroyable'; - Ember._unregisterDestructor

@ember/engine (PR: #19923)

  • import Engine from '@ember/engine'; - Ember.Engine
  • import { getEngineParent } from '@ember/engine'; - Ember.getEngineParent
  • import EngineInstance from '@ember/engine/instance'; - Ember.EngineInstance

@ember/enumerable

  • import Enumerable from '@ember/enumerable'; - Ember.Enumerable

@ember/error (PR: #19947)

  • import EmberError from '@ember/error'; - Ember.Error

@ember/helper (PR: #19947)

  • import { array } from '@ember/helper'; - Ember._array
  • import { capabilities } from '@ember/helper'; - Ember._helperManagerCapabilities
  • import { concat } from '@ember/helper'; - Ember._concat
  • import { fn } from '@ember/helper'; - Ember._fn
  • import { get } from '@ember/helper'; - Ember._get
  • import { hash } from '@ember/helper'; - Ember._hash
  • import { invokeHelper } from '@ember/helper'; - Ember._invokeHelper
  • import { setHelperManager } from '@ember/helper'; - Ember._setHelperManager

@ember/instrumentation

  • import { instrument } from '@ember/instrumentation'; - Ember.Instrumentation.instrument
  • import { reset } from '@ember/instrumentation'; - Ember.Instrumentation.reset
  • import { subscribe } from '@ember/instrumentation'; - Ember.Instrumentation.subscribe
  • import { unsubscribe } from '@ember/instrumentation'; - Ember.Instrumentation.unsubscribe

@ember/map

  • import EmberMap from '@ember/map'; - Ember.Map
  • import MapWithDefault from '@ember/map/with-default'; - Ember.MapWithDefault

@ember/modifier

  • import { capabilities } from '@ember/modifier'; - Ember._modifierManagerCapabilities
  • import { on } from '@ember/modifier'; - Ember._on
  • import { setModifierManager } from '@ember/modifier'; - Ember._setModifierManager

@ember/object

  • import EmberObject from '@ember/object'; - Ember.Object
  • import { action } from '@ember/object'; - Ember._action
  • import { aliasMethod } from '@ember/object'; - Ember.aliasMethod
  • import { computed } from '@ember/object'; - Ember.computed
  • import { defineProperty } from '@ember/object'; - Ember.defineProperty
  • import { get } from '@ember/object'; - Ember.get
  • import { getProperties } from '@ember/object'; - Ember.getProperties
  • import { getWithDefault } from '@ember/object'; - Ember.getWithDefault
  • import { notifyPropertyChange } from '@ember/object'; - Ember.notifyPropertyChange
  • import { observer } from '@ember/object'; - Ember.observer
  • import { set } from '@ember/object'; - Ember.set
  • import { setProperties } from '@ember/object'; - Ember.setProperties
  • import { trySet } from '@ember/object'; - Ember.trySet
  • import { dependentKeyCompat } from '@ember/object/compat'; - Ember._dependentKeyCompat
  • import ComputedProperty from '@ember/object/computed'; - Ember.ComputedProperty
  • import { alias } from '@ember/object/computed'; - Ember.computed.alias
  • import { and } from '@ember/object/computed'; - Ember.computed.and
  • import { bool } from '@ember/object/computed'; - Ember.computed.bool
  • import { collect } from '@ember/object/computed'; - Ember.computed.collect
  • import { deprecatingAlias } from '@ember/object/computed'; - Ember.computed.deprecatingAlias
  • import { empty } from '@ember/object/computed'; - Ember.computed.empty
  • import { equal } from '@ember/object/computed'; - Ember.computed.equal
  • import { expandProperties } from '@ember/object/computed'; - Ember.expandProperties
  • import { filter } from '@ember/object/computed'; - Ember.computed.filter
  • import { filterBy } from '@ember/object/computed'; - Ember.computed.filterBy
  • import { filterProperty } from '@ember/object/computed'; - Ember.computed.filterProperty
  • import { gt } from '@ember/object/computed'; - Ember.computed.gt
  • import { gte } from '@ember/object/computed'; - Ember.computed.gte
  • import { intersect } from '@ember/object/computed'; - Ember.computed.intersect
  • import { lt } from '@ember/object/computed'; - Ember.computed.lt
  • import { lte } from '@ember/object/computed'; - Ember.computed.lte
  • import { map } from '@ember/object/computed'; - Ember.computed.map
  • import { mapBy } from '@ember/object/computed'; - Ember.computed.mapBy
  • import { mapProperty } from '@ember/object/computed'; - Ember.computed.mapProperty
  • import { match } from '@ember/object/computed'; - Ember.computed.match
  • import { max } from '@ember/object/computed'; - Ember.computed.max
  • import { min } from '@ember/object/computed'; - Ember.computed.min
  • import { none } from '@ember/object/computed'; - Ember.computed.none
  • import { not } from '@ember/object/computed'; - Ember.computed.not
  • import { notEmpty } from '@ember/object/computed'; - Ember.computed.notEmpty
  • import { oneWay } from '@ember/object/computed'; - Ember.computed.oneWay
  • import { or } from '@ember/object/computed'; - Ember.computed.or
  • import { readOnly } from '@ember/object/computed'; - Ember.computed.readOnly
  • import { reads } from '@ember/object/computed'; - Ember.computed.reads
  • import { setDiff } from '@ember/object/computed'; - Ember.computed.setDiff
  • import { sort } from '@ember/object/computed'; - Ember.computed.sort
  • import { sum } from '@ember/object/computed'; - Ember.computed.sum
  • import { union } from '@ember/object/computed'; - Ember.computed.union
  • import { uniq } from '@ember/object/computed'; - Ember.computed.uniq
  • import { uniqBy } from '@ember/object/computed'; - Ember.computed.uniqBy
  • import CoreObject from '@ember/object/core'; - Ember.CoreObject
  • import Evented from '@ember/object/evented'; - Ember.Evented
  • import { on } from '@ember/object/evented'; - Ember.on
  • import { addListener } from '@ember/object/events'; - Ember.addListener
  • import { removeListener } from '@ember/object/events'; - Ember.removeListener
  • import { sendEvent } from '@ember/object/events'; - Ember.sendEvent
  • import { cacheFor } from '@ember/object/internals'; - Ember.cacheFor
  • import { copy } from '@ember/object/internals'; - Ember.copy
  • import { guidFor } from '@ember/object/internals'; - Ember.guidFor
  • import Mixin from '@ember/object/mixin'; - Ember.Mixin
  • import Observable from '@ember/object/observable'; - Ember.Observable
  • import { addObserver } from '@ember/object/observers'; - Ember.addObserver
  • import { removeObserver } from '@ember/object/observers'; - Ember.removeObserver
  • UNTESTED import PromiseProxyMixin from '@ember/object/promise-proxy-mixin'; - Ember.PromiseProxyMixin
  • UNTESTED INTERNALLYimport ObjectProxy from '@ember/object/proxy'; - Ember.ObjectProxy

@ember/polyfills (PR: #19947)

  • import { assign } from '@ember/polyfills'; - Ember.assign
  • import { create } from '@ember/polyfills'; - Ember.create
  • UNTESTED import { hasPropertyAccessors } from '@ember/polyfills'; - Ember.platform.hasPropertyAccessors
  • import { keys } from '@ember/polyfills'; - Ember.keys
  • import { merge } from '@ember/polyfills'; - Ember.merge

@ember/routing

  • import { LinkTo } from '@ember/routing'; - Ember.LinkComponent
  • import AutoLocation from '@ember/routing/auto-location'; - Ember.AutoLocation
  • import HashLocation from '@ember/routing/hash-location'; - Ember.HashLocation
  • import HistoryLocation from '@ember/routing/history-location'; - Ember.HistoryLocation
  • import LinkComponent from '@ember/routing/link-component'; - Ember.LinkComponent
  • import Location from '@ember/routing/location'; - Ember.Location
  • import NoneLocation from '@ember/routing/none-location'; - Ember.NoneLocation
  • import Route from '@ember/routing/route'; - Ember.Route
  • import EmberRouter from '@ember/routing/router'; - Ember.Router
  • import RouterService from '@ember/routing/router-service'; - Ember.RouterService

@ember/runloop (PR: #19947)

  • import { _backburner } from '@ember/runloop'; - Ember.run.backburner
  • import { _cancelTimers } from '@ember/runloop'; - Ember.run.cancelTimers
  • import { _getCurrentRunLoop } from '@ember/runloop'; - Ember.run._getCurrentRunLoop
  • import { _hasScheduledTimers } from '@ember/runloop'; - Ember.run.hasScheduledTimers
  • import { begin } from '@ember/runloop'; - Ember.run.begin
  • import { bind } from '@ember/runloop'; - Ember.run.bind
  • import { cancel } from '@ember/runloop'; - Ember.run.cancel
  • import { debounce } from '@ember/runloop'; - Ember.run.debounce
  • import { end } from '@ember/runloop'; - Ember.run.end
  • import { join } from '@ember/runloop'; - Ember.run.join
  • import { later } from '@ember/runloop'; - Ember.run.later
  • import { next } from '@ember/runloop'; - Ember.run.next
  • import { once } from '@ember/runloop'; - Ember.run.once
  • import { run } from '@ember/runloop'; - Ember.run
  • import { schedule } from '@ember/runloop'; - Ember.run.schedule
  • import { scheduleOnce } from '@ember/runloop'; - Ember.run.scheduleOnce
  • import { throttle } from '@ember/runloop'; - Ember.run.throttle

@ember/service

  • import Service from '@ember/service'; - Ember.Service
  • import { inject } from '@ember/service'; - Ember.inject.service
  • import { service } from '@ember/service';

@ember/template (PR: #19947)

  • import { htmlSafe } from '@ember/template'; - Ember.String.htmlSafe
  • import { isHTMLSafe } from '@ember/template'; - Ember.String.isHTMLSafe

@ember/template-compilation NO EXTERNAL TYPES

  • import { compileTemplate } from '@ember/template-compilation'; - Ember.HTMLBars.compile
  • import { precompileTemplate } from '@ember/template-compilation'; - Ember.HTMLBars.precompile

@ember/template-factory NO EXTERNAL TYPES

  • import { createTemplateFactory } from '@ember/template-factory'; - Ember.HTMLBars.template

@ember/utils (PR: #19947)

  • import { compare } from '@ember/utils'; - Ember.compare
  • import { isBlank } from '@ember/utils'; - Ember.isBlank
  • import { isEmpty } from '@ember/utils'; - Ember.isEmpty
  • import { isEqual } from '@ember/utils'; - Ember.isEqual
  • import { isNone } from '@ember/utils'; - Ember.isNone
  • import { isPresent } from '@ember/utils'; - Ember.isPresent
  • import { tryInvoke } from '@ember/utils'; - Ember.tryInvoke
  • import { typeOf } from '@ember/utils'; - Ember.typeOf

@ember/version (PR: #19947)

  • import { VERSION } from '@ember/version'; - Ember.VERSION

Packages to stabilize

This is a list of all types exported by DT. Items should be marked here when they've been compared to the DT types and validated as correct. Note that the DT types could be incorrect in some cases.

@wagenet wagenet changed the title [QUEST] Future Public Typescript Types [QUEST] Future Public TypeScript Types Feb 7, 2022
@chriskrycho
Copy link
Contributor

@wagenet what's the status on the open items in this one?

@wagenet
Copy link
Member Author

wagenet commented Nov 20, 2022

Good question. I'll try to give an update this week.

@chriskrycho
Copy link
Contributor

We actually do need the import Ember from 'ember' types, because at least some of them are not actually available anywhere else (e.g. Ember.testing). We should, separately, close any remaining gaps and deprecate the Ember namespace export for removal (presumably in 6.0).

@chriskrycho
Copy link
Contributor

chriskrycho commented Nov 29, 2022

Mechanically, for validating a package for stability, here is a rough guide to workflow for anyone who wants to contribute:

  1. Update types/publish.mjs to remove the package you are working on from the PREVIEW_MODULES definition. For example, if you were working on stabilizing @ember/application, you would apply the following diff:

      './@ember/-internals/views/lib/views/states.d.ts',
      './@ember/-internals/views/lib/views/states/default.d.ts',
      './@ember/-internals/views/lib/views/states/destroying.d.ts',
      './@ember/-internals/views/lib/views/states/has_element.d.ts',
      './@ember/-internals/views/lib/views/states/in_dom.d.ts',
      './@ember/-internals/views/lib/views/states/pre_render.d.ts',
    - './@ember/application/index.d.ts',
    - './@ember/application/instance.d.ts',
    - './@ember/application/lib/lazy_load.d.ts',
    - './@ember/application/namespace.d.ts',
      './@ember/array/index.d.ts',
      './@ember/array/mutable.d.ts',
      './@ember/array/proxy.d.ts',
  2. Run the type tests against the published types:

    yarn build:types
    yarn type-check:types
  3. Figure out whether discrepancies are the fault of the preview types or Ember's own types (with a presumption that it's the former, for obvious reasons; but there's enough any and unsafe casting in Ember that it's not a guarantee for sure) and fix them in the appropriate spot.

  4. Open a PR, and link to it here!

theroncross added a commit to theroncross/ember.js that referenced this issue Dec 17, 2022
theroncross added a commit to theroncross/ember.js that referenced this issue Jan 19, 2023
The updated types and tests now match those of `Object.assign`

toward emberjs#19946
@chriskrycho chriskrycho linked a pull request Apr 28, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants