We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TypeScript Version: 3.6.3
Search Terms:
Code
class Par { obj = { a: 'par property' } tempObj = { a: 'temp par property' } } class Sub extends Par { // error type, obj is any obj = Object.assign({ b: 'sub property' }, this.obj as Par["obj"]) _tempObj: any = this.tempObj // correct type, tempObj is Par["tempObj"] & {b : string} tempObj = Object.assign({ b: 'temp sub property' }, this._tempObj as Par["tempObj"]) }
Expected behavior:
obj and tempObj type should be same
obj
tempObj
Actual behavior:
obj type is any
Playground Link: http://www.typescriptlang.org/play/?ssl=17&ssc=31&pln=18&pc=1#code/MYGwhgzhAEAKYCdoG8CwAoa0D2AjAVtALwoZZZgBc0A5AA6LR0LZ0CmCALgJ41nQBfDP05sAtnQDyBYqUzkqtURKaNmrDjz7yh6XRlCQYAZQCuuaGwAeogHYATGPCRp5AejfQAlreDYECGzAnNA87Px4hCTS+EGcAHRGXgDmtgAUruTQuNQ0EOZMLOxcvPwCADShABZeEPGR0JBwiADaAESRbQC6AJTC8gD6ylIE1GC23LKcNXXDMf1YHtB+AXGh3OHyczLRBHGJUCnpmeQ5SuJ00PkW6sVaZZXTtfFDFzGNTq1t2-jdPVgYfToPy2CDYEBseIgbDJNK2NgAd2gZlwaR6-yAA
Related Issues:
The text was updated successfully, but these errors were encountered:
Not mentioned in OP: this is flagged as an error.
Due to architectural constraints around how trees are marked as checked, this has to be treated as a circular reference despite the type assertion.
Sorry, something went wrong.
@RyanCavanaugh thanks for replying, it is possible extend parent class object field without temp variable?
No branches or pull requests
TypeScript Version: 3.6.3
Search Terms:
Code
Expected behavior:
obj
andtempObj
type should be sameActual behavior:
obj
type is anyPlayground Link:
http://www.typescriptlang.org/play/?ssl=17&ssc=31&pln=18&pc=1#code/MYGwhgzhAEAKYCdoG8CwAoa0D2AjAVtALwoZZZgBc0A5AA6LR0LZ0CmCALgJ41nQBfDP05sAtnQDyBYqUzkqtURKaNmrDjz7yh6XRlCQYAZQCuuaGwAeogHYATGPCRp5AejfQAlreDYECGzAnNA87Px4hCTS+EGcAHRGXgDmtgAUruTQuNQ0EOZMLOxcvPwCADShABZeEPGR0JBwiADaAESRbQC6AJTC8gD6ylIE1GC23LKcNXXDMf1YHtB+AXGh3OHyczLRBHGJUCnpmeQ5SuJ00PkW6sVaZZXTtfFDFzGNTq1t2-jdPVgYfToPy2CDYEBseIgbDJNK2NgAd2gZlwaR6-yAA
Related Issues:
The text was updated successfully, but these errors were encountered: